diff options
author | Zachary Yedidia <zyedidia@gmail.com> | 2022-05-10 15:27:10 -0700 |
---|---|---|
committer | Zachary Yedidia <zyedidia@gmail.com> | 2022-05-10 15:27:10 -0700 |
commit | 09c56c06b254456251025cae338eab1db4ea04f9 (patch) | |
tree | 6ee27ce1fea7bfb1d74fe8ea1b303db6a8bd84b5 | |
parent | 72f2f6ef0334e3ae08361c94c31091a64e8a4c77 (diff) |
Syscalls access all registerssyscall
-rw-r--r-- | interrupts-asm.s | 10 | ||||
-rw-r--r-- | syscall.c | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/interrupts-asm.s b/interrupts-asm.s index bde4032..3e8b119 100644 --- a/interrupts-asm.s +++ b/interrupts-asm.s @@ -28,10 +28,14 @@ asm_undef_insn: mov sp, #INT_STACK_ADDR ldr pc, _vec_undef_insn asm_software_irq: - push {r1-r12,r14} + mov sp, #INT_STACK_ADDR + sub lr, lr, #4 + push {lr} + stmfd sp, {r0-r14}^ + sub sp, sp, #60 + mov r0, sp bl syscall - pop {r1-r12,r14} - movs pc, lr + ldm sp, {r0-r15}^ asm_prefetch_abort: mov sp, #INT_STACK_ADDR ldr pc, _vec_prefetch_abort @@ -1,10 +1,12 @@ #include "pios.h" #include "syscall.h" -void syscall(unsigned sysno) { +void syscall(user_regs_t* regs) { + unsigned sysno = regs->r0; switch (sysno) { case SYSCALL_EXIT: - panic("exit unimplemented\n"); + printf("Exiting\n"); + reboot(); break; default: panic("unhandled syscall %d\n", sysno); |