32 lines
409 B
ArmAsm
32 lines
409 B
ArmAsm
# Initial process execs /init.
|
|
# This code runs in user space.
|
|
|
|
#include "syscall.h"
|
|
#include "traps.h"
|
|
|
|
|
|
# exec(init, argv)
|
|
.globl start
|
|
start:
|
|
mov $init, %rdi
|
|
mov $argv, %rsi
|
|
mov $SYS_exec, %rax
|
|
syscall
|
|
|
|
# for(;;) exit();
|
|
exit:
|
|
mov $SYS_exit, %rax
|
|
syscall
|
|
jmp exit
|
|
|
|
# char init[] = "/init\0";
|
|
init:
|
|
.string "/init\0"
|
|
|
|
# char *argv[] = { init, 0 };
|
|
.p2align 2
|
|
argv:
|
|
.long init
|
|
.long 0
|
|
|