From 2c429f6e1ac51ea27f203005eeef20d2b05c759e Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sat, 23 Jun 2018 08:28:19 +1000 Subject: Re-wrote interrupt handling. Now, flush_idt only initializes IDT entries 32-255. A separate routine in the new file traps.s initializes the first 32 entries with addresses pointing to exception handlers within said file. Modified the register_isr function to now accept a descriptor privilege level which it will assign to the modified IDT entry. Added a task state segment and corresponding entry to the GDT. The TSS will store the kernel's stack pointer and stack segment when switching to userspace. NOTE: The stack pointer MUST be saved manually before switching to userspace! Added the framework for a system call interface at interrupt vector 0x80 (128). --- kernel/usrspace.s | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'kernel/usrspace.s') diff --git a/kernel/usrspace.s b/kernel/usrspace.s index e52f2e0..1d20f71 100644 --- a/kernel/usrspace.s +++ b/kernel/usrspace.s @@ -1,6 +1,7 @@ global userspace_init -extern _binary_usrbin_bin_start extern _binary_usrbin_bin_size +extern _binary_usrbin_bin_start +extern tss userspace_init: push ebp @@ -32,8 +33,10 @@ usrcall: mov fs, ax mov gs, ax mov eax, esp + ; save ESP in the TSS + mov [tss+4], eax push dword 0x23 - push eax + push dword 0x00180000 pushf push dword 0x1B push dword 0x00100000 -- cgit v1.3