> 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 22:17:25 up 6 days, 17:23, 1 user, load average: 0.54, 0.69, 0.87
This commit is contained in:
@ -8,7 +8,7 @@ size_t _write(int fd, const void *buf, size_t count) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
putch(((const char*)buf)[i]);
|
||||
}
|
||||
return 1;
|
||||
return count;
|
||||
}
|
||||
|
||||
void _sbrk(intptr_t increment) {
|
||||
@ -22,11 +22,12 @@ void do_syscall(Context *c) {
|
||||
a[2] = c->GPR3;
|
||||
a[3] = c->GPR4;
|
||||
|
||||
TRACE("syscall %d: %s | %d | %s | %d", a[0], __syscall_names[a[0]], a[1], a[2], a[3]);
|
||||
TRACE("syscall %d: %s", a[0], __syscall_names[a[0]]);
|
||||
switch (a[0]) {
|
||||
case SYS_yield: yield(); break;
|
||||
case SYS_write: c->GPRx = _write(a[1], (void*)a[2], a[3]);
|
||||
case SYS_write: c->GPRx = _write(a[1], (void*)a[2], a[3]); break;
|
||||
case SYS_exit: halt(0); break;
|
||||
default: panic("Unhandled syscall ID = %d", a[0]);
|
||||
}
|
||||
TRACE("syscall %d: %d done", a[0], c->GPRx);
|
||||
}
|
||||
|
Reference in New Issue
Block a user