Prettify syscalls

This commit is contained in:
Mark
2020-01-30 17:41:33 +02:00
parent cbb39f9d77
commit f7b337ecd5
2 changed files with 18 additions and 2 deletions
+10
View File
@@ -0,0 +1,10 @@
#pragma once
#define SYSCALL_NR_FORK 57
int sys_fork(void *ctx);
#define SYSCALL_NR_EXIT 60
__attribute__((noreturn)) void sys_exit(int status);
#define SYSCALL_NR_DEBUG_TRACE 255
void sys_debug_trace(const char *msg);
+8 -2
View File
@@ -1,4 +1,5 @@
#include "sys/amd64/cpu.h"
#include "sys/syscall.h"
#include "sys/debug.h"
#define MSR_IA32_STAR 0xC0000081
@@ -7,11 +8,16 @@
extern void syscall_entry(void);
extern __attribute__((noreturn)) void sys_exit(int status);
void sys_debug_trace(const char *msg) {
kdebug("Trace message: %s\n", msg);
}
void *syscall_table[256] = {
NULL,
[60] = sys_exit,
[SYSCALL_NR_EXIT] = sys_exit,
[SYSCALL_NR_DEBUG_TRACE] = sys_debug_trace,
};
void syscall_undefined(uint64_t rax) {