33 for (
uint64_t i = 0; i < syscallsInTable; i++)
80 LOG_DEBUG(
"Unknown syscall %u\n", number);
87 uint64_t result = handler(rdi, rsi, rdx, rcx, r8, r9);
#define assert(expression)
@ GDT_KERNEL_CODE
Kernel code segment selector.
@ GDT_USER_CODE
User code segment selector.
@ INTERRUPT_NOTE
Nofify that a note is available.
syscall_descriptor_t _syscallTableEnd[]
Linker defined end of the syscall table.
void syscall_table_init(void)
Initialize the syscall table.
syscall_descriptor_t _syscallTableStart[]
Linker defined start of the syscall table.
void syscalls_cpu_init(void)
Initalize syscalls on the current CPU.
void syscall_ctx_init(syscall_ctx_t *ctx, stack_pointer_t *kernelStack)
Initialize a per-thread syscall context.
void syscall_ctx_load(syscall_ctx_t *ctx)
Load a syscall context into the CPU.
void syscall_entry(void)
Assembly entry point for syscalls.
uint64_t syscall_handler(uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx, uint64_t r8, uint64_t r9, uint64_t number)
C syscall handler.
lapic_id_t lapic_self_id(void)
Get the lapic id of the current cpu.
void lapic_send_ipi(lapic_id_t id, interrupt_t vector)
Send an Inter-Processor Interrupt (IPI) to a local apic.
uint64_t note_queue_length(note_queue_t *queue)
Get the length of a note queue.
#define LOG_INFO(format,...)
#define LOG_DEBUG(format,...)
thread_t * sched_thread_unsafe(void)
Retrieves the currently running thread without disabling interrupts.
#define ENOSYS
Function not implemented.
#define errno
Error number variable.
#define NULL
Pointer error value.
#define ERR
Integer error value.
#define RFLAGS_INTERRUPT_ENABLE
#define RFLAGS_NESTED_TASK
static void msr_write(uint32_t msr, uint64_t value)
#define EFER_SYSCALL_ENABLE
static uint64_t msr_read(uint32_t msr)
#define MSR_SYSCALL_FLAG_MASK
#define MSR_KERNEL_GS_BASE
_PUBLIC void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
Structure to define a stack in memory.
uintptr_t top
The top of the stack, this address is not inclusive.
Per thread syscall context.
int syscall_descriptor_cmp(const void *a, const void *b)
const syscall_descriptor_t * syscall_get_descriptor(uint64_t number)