2007-08-21 19:22:08 +00:00
|
|
|
# Initial process execs /init.
|
|
|
|
|
|
|
|
#include "syscall.h"
|
|
|
|
#include "traps.h"
|
|
|
|
|
2011-07-27 20:35:46 -04: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:
|
2011-07-27 20:35:46 -04:00
|
|
|
movl $SYS_init, %eax
|
|
|
|
int $T_SYSCALL
|
2007-08-21 19:22:08 +00:00
|
|
|
pushl $argv
|
|
|
|
pushl $init
|
2009-07-11 19:26:01 -07:00
|
|
|
pushl $0 // where caller pc would be
|
2007-08-21 19:22:08 +00:00
|
|
|
movl $SYS_exec, %eax
|
|
|
|
int $T_SYSCALL
|
|
|
|
|
|
|
|
# for(;;) exit();
|
|
|
|
exit:
|
|
|
|
movl $SYS_exit, %eax
|
|
|
|
int $T_SYSCALL
|
|
|
|
jmp exit
|
|
|
|
|
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
|
|
|
|
|