blob: 7bdb24b91192afc3a71680748910f2ece01b5ff7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <kernel/syscall.h>
#include <kernel/io.h>
#include <stddef.h>
int handle_syscall(struct isr_frame *frame) {
switch (frame->eax) {
case SYS_REBOOT:
kprintf("REBOOT NOT SUPPORTED\n");
break;
default:
kprintf("Error: Invalid system call number: %d\n", frame->eax);
halt_catch_fire(frame);
}
return 0;
}
void dump_reg(struct isr_frame *frame) {
kprintf("Registers at interrupt:\n");
kprintf("\tEAX = %x\n", frame->eax);
kprintf("\tEBX = %x\n", frame->ebx);
kprintf("\tECX = %x\n", frame->ecx);
kprintf("\tEDX = %x\n", frame->edx);
kprintf("\tESI = %x\n", frame->esi);
kprintf("\tEDI = %x\n", frame->edi);
kprintf("\tEIP = %x\n", frame->eip);
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));
}
|