diff options
| author | Jon Santmyer <jon@jonsantmyer.com> | 2026-09-05 11:38:27 -0400 |
|---|---|---|
| committer | Jon Santmyer <jon@jonsantmyer.com> | 2026-09-05 11:38:27 -0400 |
| commit | 73cbb23130f634bf52ac92da063efd3e6016f8ee (patch) | |
| tree | 09a15da6495898f72d88e31185dac15f21682a09 /arch/x86_64/sys | |
| parent | 69a27cf95a8a8e3bbbd5e3d81a36893bf312cf3e (diff) | |
| download | jove-kernel-73cbb23130f634bf52ac92da063efd3e6016f8ee.tar.gz jove-kernel-73cbb23130f634bf52ac92da063efd3e6016f8ee.tar.bz2 jove-kernel-73cbb23130f634bf52ac92da063efd3e6016f8ee.zip | |
make objdir_getlocal return locked object
Diffstat (limited to 'arch/x86_64/sys')
| -rw-r--r-- | arch/x86_64/sys/init.c | 4 | ||||
| -rw-r--r-- | arch/x86_64/sys/syscall.c | 58 |
2 files changed, 59 insertions, 3 deletions
diff --git a/arch/x86_64/sys/init.c b/arch/x86_64/sys/init.c index 2bd86d5..26eefde 100644 --- a/arch/x86_64/sys/init.c +++ b/arch/x86_64/sys/init.c @@ -77,7 +77,7 @@ init_setup(void) kpanic("Kernel commandline is missing 'init' arg.\n"); } - jove_owned_obj_t *initrd_obj = obj_take(objdir_getlocal(_rootdir_obj, ROOTDIR_INITRD_I)); + jove_owned_obj_t *initrd_obj = objdir_getlocal(_rootdir_obj, ROOTDIR_INITRD_I); jove_owned_obj_t *init_obj = initrd_seek(initrd_obj, init_path); if(init_obj == NULL) { kpanic("init: Cannot find file '%s' in initrd.\n", init_path); @@ -96,7 +96,7 @@ init_setup(void) kpanic("init: Either passed file '%s' is not an ELF file or is not loadable.\n", init_path); } - jove_owned_obj_t *init_pagedir = obj_take(objdir_getlocal(_rootdir_obj, ROOTDIR_PAGEDIR_I)); + jove_owned_obj_t *init_pagedir = objdir_getlocal(_rootdir_obj, ROOTDIR_PAGEDIR_I); page_t *pml4 = obj_deref(init_pagedir); //Load the init ELF diff --git a/arch/x86_64/sys/syscall.c b/arch/x86_64/sys/syscall.c index 8cc58bf..4e95225 100644 --- a/arch/x86_64/sys/syscall.c +++ b/arch/x86_64/sys/syscall.c @@ -1,7 +1,63 @@ +#include "arch/x86_64/hal/process.h" +#include "arch/x86_64/hal/smp.h" +#include "hal/smp.h" +#include "jove.h" +int +syscall_handler_arch(uint64_t message_path_raw, uint64_t message_pathlen) +{ + uint16_t *message_path = (uint16_t*)&message_path_raw; + if(message_pathlen > 4) { + return EBADPATH; + } + processor_t *proc = processor_current(); + jove_owned_obj_t *objdir = obj_take(proc->pcb->rootdir); + jove_owned_obj_t *message_obj = objdir_getobj(objdir, message_path, message_pathlen); + if(message_obj == 0) { + obj_release(objdir); + return errno; + } + + return 0; +} __attribute__((naked)) void _syscall_entry(void) { - + __asm__ volatile(" \ + swapgs; \ + movq %%gs:%c[pcb], %%rax; \ + movq %%rsp, %%rdx; \ + movq %c[ksp](%%rax), %%rsp; \ + pushq %%rdx; \ + pushq %%r11; \ + pushq %%rbx; \ + pushq %%rcx; \ + pushq %%rbp; \ + pushq %%r12; \ + pushq %%r13; \ + pushq %%r14; \ + pushq %%r15; \ + callq syscall_handler_arch; \ + swapgs; \ + popq %%r15; \ + popq %%r14; \ + popq %%r13; \ + popq %%r12; \ + popq %%rbp; \ + popq %%rcx; \ + popq %%rbx; \ + xorq %%rdx, %%rdx; \ + xorq %%rsi, %%rsi; \ + xorq %%rdi, %%rdi; \ + xorq %%r8, %%r8; \ + xorq %%r9, %%r9; \ + xorq %%r10, %%r10; \ + popq %%rcx; \ + popq %%r11; \ + popq %%rsp; \ + sysretq;" + :: + [pcb] "i"(offsetof(processor_t, pcb)), + [ksp] "i"(offsetof(pcb_t, ksp))); } |
