2007-08-21 21:22:08 +02:00
|
|
|
# Initial process execs /init.
|
|
|
|
|
|
|
|
#include "syscall.h"
|
|
|
|
#include "traps.h"
|
|
|
|
|
2011-07-28 02:35:46 +02:00
|
|
|
|
2007-08-21 21:22:08 +02:00
|
|
|
# exec(init, argv)
|
2007-08-28 01:32:16 +02:00
|
|
|
.globl start
|
2007-08-21 21:22:08 +02:00
|
|
|
start:
|
2011-07-28 02:35:46 +02:00
|
|
|
movl $SYS_init, %eax
|
|
|
|
int $T_SYSCALL
|
2007-08-21 21:22:08 +02:00
|
|
|
pushl $argv
|
|
|
|
pushl $init
|
2009-07-12 04:26:01 +02:00
|
|
|
pushl $0 // where caller pc would be
|
2007-08-21 21:22:08 +02:00
|
|
|
movl $SYS_exec, %eax
|
|
|
|
int $T_SYSCALL
|
|
|
|
|
|
|
|
# for(;;) exit();
|
|
|
|
exit:
|
|
|
|
movl $SYS_exit, %eax
|
|
|
|
int $T_SYSCALL
|
|
|
|
jmp exit
|
|
|
|
|
2007-08-24 21:37:24 +02:00
|
|
|
# char init[] = "/init\0";
|
2007-08-21 21:22:08 +02:00
|
|
|
init:
|
|
|
|
.string "/init\0"
|
|
|
|
|
2007-08-24 21:37:24 +02:00
|
|
|
# char *argv[] = { init, 0 };
|
2007-08-21 21:22:08 +02:00
|
|
|
.p2align 2
|
|
|
|
argv:
|
|
|
|
.long init
|
|
|
|
.long 0
|
|
|
|
|