syscall lab finished

This commit is contained in:
2025-03-25 11:36:21 +08:00
parent a087b429df
commit 992f76ca30
11 changed files with 223 additions and 2 deletions

View File

@ -8,9 +8,9 @@
#include "defs.h"
// 保留系统调用别名
char* syscalls_name[24] = {"", "fork", "exit", "wait", "pipe", "read", "kill", "exec",
char* syscalls_name[25] = {"", "fork", "exit", "wait", "pipe", "read", "kill", "exec",
"fstat", "chdir", "dup", "getpid", "sbrk", "sleep", "uptime",
"open", "write", "mknod", "unlink", "link", "mkdir", "close", "trace"};
"open", "write", "mknod", "unlink", "link", "mkdir", "close", "trace", "sysinfo"};
// Fetch the uint64 at addr from the current process.
int
@ -107,6 +107,7 @@ extern uint64 sys_link(void);
extern uint64 sys_mkdir(void);
extern uint64 sys_close(void);
extern uint64 sys_trace(void);
extern uint64 sys_sysinfo(void);
// An array mapping syscall numbers from syscall.h
// to the function that handles the system call.
@ -133,6 +134,7 @@ static uint64 (*syscalls[])(void) = {
[SYS_mkdir] sys_mkdir,
[SYS_close] sys_close,
[SYS_trace] sys_trace,
[SYS_sysinfo] sys_sysinfo,
};
void