> 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 15:12:30 up 8 days, 2:56, 1 user, load average: 0.10, 0.20, 0.30
This commit is contained in:
@ -26,7 +26,7 @@ void init_proc() {
|
||||
|
||||
// load program here
|
||||
void naive_uload(PCB *pcb, const char *filename);
|
||||
naive_uload(NULL, "/bin/menu");
|
||||
naive_uload(NULL, "/bin/dummy");
|
||||
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,12 @@ int _gettimeofday(struct timeval *tv, struct timezone *tz) {
|
||||
|
||||
int _execve(const char *fname, char *const argv[], char *const envp[]);
|
||||
|
||||
void _exit(int status) {
|
||||
printf("!!!!!!!!!!!!!!!!!!!!Exit with status %d\n", status);
|
||||
halt(status);
|
||||
_execve("/bin/menu", NULL, NULL);
|
||||
}
|
||||
|
||||
#define CASE(syscall, ...) case _SYSCALL_NAME(syscall): __VA_ARGS__; break;
|
||||
void do_syscall(Context *c) {
|
||||
uintptr_t a[4];
|
||||
@ -38,7 +44,7 @@ void do_syscall(Context *c) {
|
||||
CASE(gettimeofday, c->GPRx = _gettimeofday((struct timeval*)a[1], (struct timezone*)a[2]))
|
||||
CASE(execve, c->GPRx = _execve((const char*)a[1], (char* const*)a[2], (char* const*)a[3]))
|
||||
CASE(brk, c->GPRx = _brk((void*)a[1]))
|
||||
CASE(exit, _execve("/bin/menu", NULL, NULL))
|
||||
CASE(exit, halt(0))
|
||||
default: panic("Unhandled syscall ID = %d", a[0]);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ static int cmd_echo(char *args) {
|
||||
}
|
||||
|
||||
static int cmd_exit(char *args) {
|
||||
exit(0);
|
||||
execve("/bin/menu", NULL, NULL);
|
||||
}
|
||||
|
||||
static struct {
|
||||
|
Reference in New Issue
Block a user