1 | # Initial process execs /init. |
---|---|
2 | # This code runs in user space. |
3 | |
4 | #include "syscall.h" |
5 | #include "traps.h" |
6 | |
7 | |
8 | # exec(init, argv) |
9 | .globl start |
10 | start: |
11 | pushl $argv |
12 | pushl $init |
13 | pushl $0 // where caller pc would be |
14 | movl $SYS_exec, %eax |
15 | int $T_SYSCALL |
16 | |
17 | # for(;;) exit(); |
18 | exit: |
19 | movl $SYS_exit, %eax |
20 | int $T_SYSCALL |
21 | jmp exit |
22 | |
23 | # char init[] = "/init\0"; |
24 | init: |
25 | .string "/init\0" |
26 | |
27 | # char *argv[] = { init, 0 }; |
28 | .p2align 2 |
29 | argv: |
30 | .long init |
31 | .long 0 |
32 | |
33 |