Draft: lab 3 irq wtf

This commit is contained in:
2025-03-24 10:48:35 +08:00
parent 6156975775
commit c5fc7e3102
19 changed files with 386 additions and 142 deletions

View File

@@ -0,0 +1,5 @@
#pragma once
void init_exception(void);
void not_implemented_handler(void);
void synchronous_handler(void);

3
kernel/include/exec.h Normal file
View File

@@ -0,0 +1,3 @@
#pragma once
void user_exec(void *text, void *sp);

View File

@@ -0,0 +1,17 @@
#pragma once
#include <stddef.h>
#define CORE0_TIMER_IRQ_CTRL ((volatile uint32_t *)0x40000040)
#define CORE0_IRQ_SOURCE ((volatile uint32_t *)0x40000060)
enum :uint32_t {
CNTPNSIRQ_INT = ((uint32_t)1 << 1),
GPU_INT = ((uint32_t)1 << 8)
};
void init_interrupt(void);
void irq_handler(void);
void enable_interrupt(void);
void disable_interrupt(void);

View File

@@ -1,15 +1,7 @@
#pragma once
#include <initrd.h>
#include <stddef.h>
void help(void);
void hello(void);
void hwinfo(void);
void memalloc(size_t size);
void ls(file_node_t *root);
void cat(file_node_t *root, const char *filename);
void reboot(void);
#include <initrd.h>
int // is continue
shell(file_node_t *);

View File

@@ -43,8 +43,14 @@ void exit(int);
: [a] "=r" (ret) \
)
#define W_SYSREG(val, reg) \
#define W_SYSREG(reg, val) \
asm volatile( \
"msr " #reg ", %[a]" \
: [a] "r" (val) \
:: [a] "r" (val) \
)
#define R_REG(ret, reg) \
asm volatile( \
"mov %[a], " #reg \
: [a] "=r" (ret) \
)