From c9a1266d219a83882735a3a8304f3824e0219cdb Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 15 Jan 2024 15:44:20 -0500 Subject: redo application paging and system calls, rename mercury to hilbert --- kernel/syscall.asm | 70 +++++++++++++----------------------------------------- 1 file changed, 17 insertions(+), 53 deletions(-) (limited to 'kernel/syscall.asm') diff --git a/kernel/syscall.asm b/kernel/syscall.asm index e4e0d77..c293402 100644 --- a/kernel/syscall.asm +++ b/kernel/syscall.asm @@ -4,51 +4,7 @@ global start_user_mode section .text -extern syscall_encode_color - -encode_color_syscall: - call syscall_encode_color - mov edi, eax - xor rax, rax - mov eax, edi - xor rdi, rdi - xor rsi, rsi - xor rdx, rdx - jmp syscall_return - -extern syscall_get_fb_vaddr -extern syscall_get_fb_dims -extern syscall_get_fb_pitch - -get_framebuffer_syscall: - call syscall_get_fb_vaddr - push rax - call syscall_get_fb_dims - push rax - call syscall_get_fb_pitch - xor rsi, rsi - mov esi, eax - pop rdi - pop rax - xor rdx, rdx - jmp syscall_return - -extern syscall_copy_framebuffer - -draw_framebuffer_syscall: - call syscall_copy_framebuffer - xor rax, rax - xor rdi, rdi - xor rsi, rsi - xor rdx, rdx - jmp syscall_return - -bad_syscall: - xor rax, rax - xor rdi, rdi - xor rsi, rsi - xor rdx, rdx - jmp syscall_return +extern do_syscall syscall_entry: mov r11, rsp @@ -56,15 +12,23 @@ syscall_entry: push r11 push rcx - cmp rax, 0 - je encode_color_syscall - cmp rax, 1 - je get_framebuffer_syscall - cmp rax, 2 - je draw_framebuffer_syscall - jmp bad_syscall + push rdx + push rsi + push rdi + push rax + + mov rdi, rsp + lea rsi, [rsp + 8] + lea rdx, [rsp + 16] + lea rcx, [rsp + 24] + + call do_syscall + + pop rax + pop rdi + pop rsi + pop rdx -syscall_return: xor r8, r8 xor r9, r9 xor r10, r10 -- cgit v1.2.3