mirror of
https://github.com/SmallPond/MIT6.828_OS.git
synced 2026-04-28 04:40:37 +08:00
HomeWork 8 is done
This commit is contained in:
32
xv6-public/initcode.S
Normal file
32
xv6-public/initcode.S
Normal file
@@ -0,0 +1,32 @@
|
||||
# Initial process execs /init.
|
||||
# This code runs in user space.
|
||||
|
||||
#include "syscall.h"
|
||||
#include "traps.h"
|
||||
|
||||
|
||||
# exec(init, argv)
|
||||
.globl start
|
||||
start:
|
||||
pushl $argv
|
||||
pushl $init
|
||||
pushl $0 // where caller pc would be
|
||||
movl $SYS_exec, %eax
|
||||
int $T_SYSCALL
|
||||
|
||||
# for(;;) exit();
|
||||
exit:
|
||||
movl $SYS_exit, %eax
|
||||
int $T_SYSCALL
|
||||
jmp exit
|
||||
|
||||
# char init[] = "/init\0";
|
||||
init:
|
||||
.string "/init\0"
|
||||
|
||||
# char *argv[] = { init, 0 };
|
||||
.p2align 2
|
||||
argv:
|
||||
.long init
|
||||
.long 0
|
||||
|
||||
Reference in New Issue
Block a user