xref: /xv6-public/initcode.S (revision 9c65b32d)
1f32f3638Srsc# Initial process execs /init.
2*9c65b32dSRobert Morris# This code runs in user space.
3f32f3638Srsc
4f32f3638Srsc#include "syscall.h"
5f32f3638Srsc#include "traps.h"
6f32f3638Srsc
713a96baeSFrans Kaashoek
8f32f3638Srsc# exec(init, argv)
919b42cc0Srsc.globl start
10f32f3638Srscstart:
11f32f3638Srsc  pushl $argv
12f32f3638Srsc  pushl $init
13f9a06440SRuss Cox  pushl $0  // where caller pc would be
14f32f3638Srsc  movl $SYS_exec, %eax
15f32f3638Srsc  int $T_SYSCALL
16f32f3638Srsc
17f32f3638Srsc# for(;;) exit();
18f32f3638Srscexit:
19f32f3638Srsc  movl $SYS_exit, %eax
20f32f3638Srsc  int $T_SYSCALL
21f32f3638Srsc  jmp exit
22f32f3638Srsc
23895c182dSrsc# char init[] = "/init\0";
24f32f3638Srscinit:
25f32f3638Srsc  .string "/init\0"
26f32f3638Srsc
27895c182dSrsc# char *argv[] = { init, 0 };
28f32f3638Srsc.p2align 2
29f32f3638Srscargv:
30f32f3638Srsc  .long init
31f32f3638Srsc  .long 0
32f32f3638Srsc
33