summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2022-03-22 13:43:54 -0500
committerDanny Holman <dholman@gymli.org>2022-03-22 13:43:54 -0500
commit84332707f1df86c25c1f94883044c5e8fe2e20a3 (patch)
tree8f047d248c89899b9b45575f63feddf360854946 /arch
parent84fe944adc002bc6e8844e9ac9c292b9d7dd3f92 (diff)
arch: i386: refactor the system call API
The x86 system call/interrupt handlers should be refactored to be more readable. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/boot/isr.s5
-rw-r--r--arch/i386/include/kernel/isr.h2
-rw-r--r--arch/i386/include/kernel/syscall.h1
-rw-r--r--arch/i386/kernel/syscall.c4
-rw-r--r--arch/i386/kernel/tty.c3
5 files changed, 4 insertions, 11 deletions
diff --git a/arch/i386/boot/isr.s b/arch/i386/boot/isr.s
index 76afa9f..893dd1f 100644
--- a/arch/i386/boot/isr.s
+++ b/arch/i386/boot/isr.s
@@ -51,8 +51,7 @@ isr_frame_asm:
movl %cr4, %eax
pushl %eax
- lea -8(%esp), %edi
- pushl %edi
+ pushl %esp
call interrupt_handler
popl %eax
@@ -71,7 +70,7 @@ isr_frame_asm:
popl %ebx
popl %eax
- addl $4, %esp
+ addl $20, %esp
iret
isr_no_err_stub 0
diff --git a/arch/i386/include/kernel/isr.h b/arch/i386/include/kernel/isr.h
index f177ee2..4e21f8f 100644
--- a/arch/i386/include/kernel/isr.h
+++ b/arch/i386/include/kernel/isr.h
@@ -11,8 +11,6 @@ struct isr_frame {
uint32_t edi;
uint32_t esi;
- uint32_t ebp;
- uint32_t esp;
uint32_t edx;
uint32_t ecx;
uint32_t ebx;
diff --git a/arch/i386/include/kernel/syscall.h b/arch/i386/include/kernel/syscall.h
index cded732..4f74c1f 100644
--- a/arch/i386/include/kernel/syscall.h
+++ b/arch/i386/include/kernel/syscall.h
@@ -3,6 +3,7 @@
#include <kernel/isr.h>
+void halt_catch_fire(struct isr_frame *frame);
void syscall_dispatch(struct isr_frame *frame);
void register_syscall(void *handler(struct isr_frame*), int num);
void sys_stop(struct isr_frame *frame);
diff --git a/arch/i386/kernel/syscall.c b/arch/i386/kernel/syscall.c
index 570f0de..18f36ad 100644
--- a/arch/i386/kernel/syscall.c
+++ b/arch/i386/kernel/syscall.c
@@ -9,7 +9,6 @@ void syscall_dispatch(struct isr_frame *frame) {
syscall_handlers[frame->eax](frame);
else
kprintf("Error: Invalid system call number: %d\n", frame->eax);
- __asm__ volatile("cli;hlt");
}
void register_syscall(void *handler(struct isr_frame*), int num) {
@@ -34,9 +33,6 @@ void dump_reg(struct isr_frame *frame) {
kprintf("\tEDX = %x\n", frame->edx);
kprintf("\tESI = %x\n", frame->esi);
kprintf("\tEDI = %x\n", frame->edi);
- kprintf("\tESP = %x\n", frame->esp);
- kprintf("\tEBP = %x\n", frame->ebp);
kprintf("\tEIP = %x\n", frame->eip);
- kprintf("\tEFLAGS = %x\n", frame->eflags);
kprintf("Current code selector: %d\n", frame->cs);
}
diff --git a/arch/i386/kernel/tty.c b/arch/i386/kernel/tty.c
index f929408..1e2e6b5 100644
--- a/arch/i386/kernel/tty.c
+++ b/arch/i386/kernel/tty.c
@@ -6,8 +6,7 @@
static const size_t VGA_WIDTH = 80;
static const size_t VGA_HEIGHT = 25;
-//static uint16_t *const VGA_MEMORY = (uint16_t*)0xC03FF000;
-static uint16_t *const VGA_MEMORY = (uint16_t*)0xB8000;
+static uint16_t *const VGA_MEMORY = (uint16_t*)0xC03FF000;
static size_t terminal_row;
static size_t terminal_column;