> compile NEMU
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 23:24:31 up 6 days, 18:30, 1 user, load average: 0.71, 1.03, 1.01
This commit is contained in:
@ -15,6 +15,7 @@ int _brk(void* addr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CASE(syscall, ...) case _SYSCALL_NAME(syscall): __VA_ARGS__; break;
|
||||
void do_syscall(Context *c) {
|
||||
uintptr_t a[4];
|
||||
a[0] = c->GPR1;
|
||||
@ -24,10 +25,10 @@ void do_syscall(Context *c) {
|
||||
|
||||
TRACE("syscall %d: %s", a[0], __syscall_names[a[0]]);
|
||||
switch (a[0]) {
|
||||
case SYS_yield: yield(); break;
|
||||
case SYS_write: c->GPRx = _write((int)a[1], (const char*)a[2], (size_t)a[3]); break;
|
||||
case SYS_brk: c->GPRx = _brk((void*)a[1]); break;
|
||||
case SYS_exit: halt(0); break;
|
||||
CASE(yield, yield())
|
||||
CASE(write, c->GPRx = _write((int)a[1], (const char*)a[2], (size_t)a[3]))
|
||||
CASE(brk, c->GPRx = _brk((void*)a[1]))
|
||||
CASE(exit, halt(0))
|
||||
default: panic("Unhandled syscall ID = %d", a[0]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user