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/usrbin/usrbin.bin | Bin 76 -> 59 bytes kernel/usrbin/usrbin.s | 26 +++----------------------- 2 files changed, 3 insertions(+), 23 deletions(-) (limited to 'kernel/usrbin') diff --git a/kernel/usrbin/usrbin.bin b/kernel/usrbin/usrbin.bin index a7d7730..bdf8c29 100644 Binary files a/kernel/usrbin/usrbin.bin and b/kernel/usrbin/usrbin.bin differ diff --git a/kernel/usrbin/usrbin.s b/kernel/usrbin/usrbin.s index 91dd94a..248d823 100644 --- a/kernel/usrbin/usrbin.s +++ b/kernel/usrbin/usrbin.s @@ -3,30 +3,10 @@ org 0x100000 main: push .msg - call puts + push byte 0 + int 0x80 add esp, 4 .loop: ; loop forever jmp .loop -.msg: db "Hello World from Userspace!", 0 - -puts: - push ebp - mov ebp, esp - push esi - push edi - mov esi, [ebp+8] - mov edi, 0xB8000 -.loop: - lodsb - cmp al, 0 - je .end - mov [edi], al - mov byte [edi+1], 0x07 - add edi, 2 - jmp .loop -.end: - pop edi - pop esi - pop ebp - ret +.msg: db "Hello World from Userspace, using syscalls!", 10, 0 -- cgit v1.3