Draft: lab 5 failed

This commit is contained in:
2025-05-03 20:45:34 +08:00
parent 981cae803b
commit e73f90395d
39 changed files with 588 additions and 429 deletions

View File

@@ -3,8 +3,10 @@
#include <stddef.h>
#include <logger.h>
#include <utils.h>
#include <syscall.h>
#include <interrupt.h>
void init_exception()
void exception_init()
{
asm volatile(
"adr x0, exception_vector_table" ENDL
@@ -18,11 +20,10 @@ void not_implemented_handler()
DEBUG_EXCEP("not implemented caught");
}
void synchronous_handler()
void synchronous_handler(trapframe_t *regs)
{
static int poop = 0;
if (poop++ > 10)
exit(ERR_ADMINKILL);
disable_interrupt();
DEBUG_EXCEP("synchronous caught");
uint64_t x0 = 0x0;
R_REG(x0, x0);
@@ -36,5 +37,12 @@ void synchronous_handler()
uint64_t esr_el1 = 0x0;
R_SYSREG(esr_el1, esr_el1);
LOG(x0); LOG(spsr_el1); LOG(elr_el1); DEBUG_EXCEP(esr_el1);
LOG(x0); LOG(spsr_el1); LOG(elr_el1); DEBUG_EXCEP(esr_el1)
switch ((esr_el1 >> 26) & 0x7f) {
case 0b010101:
syscall_handler(regs);
break;
default:
}
}