2007-08-21 19:22:08 +00:00
|
|
|
# Initial process execs /init.
|
2016-08-11 19:41:53 +00:00
|
|
|
# This code runs in user space.
|
2007-08-21 19:22:08 +00:00
|
|
|
|
|
|
|
#include "syscall.h"
|
2011-07-28 00:35:46 +00:00
|
|
|
|
2007-08-21 19:22:08 +00:00
|
|
|
# exec(init, argv)
|
2007-08-27 23:32:16 +00:00
|
|
|
.globl start
|
2007-08-21 19:22:08 +00:00
|
|
|
start:
|
2019-05-31 13:45:59 +00:00
|
|
|
la a0, init
|
|
|
|
la a1, argv
|
|
|
|
li a7, SYS_exec
|
|
|
|
ecall
|
2007-08-21 19:22:08 +00:00
|
|
|
|
|
|
|
# for(;;) exit();
|
|
|
|
exit:
|
2019-05-31 13:45:59 +00:00
|
|
|
li a7, SYS_exit
|
|
|
|
ecall
|
|
|
|
jal exit
|
2007-08-21 19:22:08 +00:00
|
|
|
|
2007-08-24 19:37:24 +00:00
|
|
|
# char init[] = "/init\0";
|
2007-08-21 19:22:08 +00:00
|
|
|
init:
|
|
|
|
.string "/init\0"
|
|
|
|
|
2007-08-24 19:37:24 +00:00
|
|
|
# char *argv[] = { init, 0 };
|
2007-08-21 19:22:08 +00:00
|
|
|
.p2align 2
|
|
|
|
argv:
|
|
|
|
.long init
|
|
|
|
.long 0
|