summaryrefslogtreecommitdiff
path: root/arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386')
-rw-r--r--arch/i386/include/kernel/syscall.h2
-rw-r--r--arch/i386/kernel/syscall.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/arch/i386/include/kernel/syscall.h b/arch/i386/include/kernel/syscall.h
index fdd6520..788e5da 100644
--- a/arch/i386/include/kernel/syscall.h
+++ b/arch/i386/include/kernel/syscall.h
@@ -2,6 +2,7 @@
#define I386_SYSCALL_H
#include <kernel/isr.h>
+#include <stddef.h>
// Unix standard calls
#define SYS_FORK 1
@@ -27,5 +28,6 @@
int handle_syscall(struct isr_frame *frame);
void dump_reg(struct isr_frame *frame);
+void dump_stack(uintptr_t esp, size_t len);
#endif
diff --git a/arch/i386/kernel/syscall.c b/arch/i386/kernel/syscall.c
index 593bb64..7bdb24b 100644
--- a/arch/i386/kernel/syscall.c
+++ b/arch/i386/kernel/syscall.c
@@ -9,6 +9,7 @@ int handle_syscall(struct isr_frame *frame) {
break;
default:
kprintf("Error: Invalid system call number: %d\n", frame->eax);
+ halt_catch_fire(frame);
}
return 0;
}
@@ -22,5 +23,10 @@ void dump_reg(struct isr_frame *frame) {
kprintf("\tESI = %x\n", frame->esi);
kprintf("\tEDI = %x\n", frame->edi);
kprintf("\tEIP = %x\n", frame->eip);
- kprintf("Current code selector: %d\n", frame->cs);
+ kprintf("Current code selector: %x\n", frame->cs);
+}
+
+void dump_stack(uint32_t esp, size_t len) {
+ for (uint32_t i = 0; i < len; i++)
+ kprintf("%x:\t%x\n", esp+i, *(uint32_t*)(esp+i));
}