Browse Source

document what exit.s does.

Lucas Stadler 11 years ago
parent
commit
eeb00ed130
1 changed files with 12 additions and 4 deletions
  1. 12 4
      pgu/01_arch/exit.s

+ 12 - 4
pgu/01_arch/exit.s

@ -1,11 +1,19 @@
1
# exit: a program that calls `exit()`
2
3
# an assembler program has sections, this section normally has data in
4
# it that the program uses. (i think this would be variables in any
5
# other language, but probably there's more.)
1 6
.section .data
2 7
8
# the program text lives here.
3 9
.section .text
4
.globl _start
10
.globl _start # a special symbol that the linker uses to start the program
5 11
12
# call `exit(0)`
6 13
_start:
7
	movl $1, %eax
14
	# $<something> is the syntax for the immediate addressing mode
15
	movl $1, %eax # exit has the syscall number 1, defined in /usr/include/asm/unistd_32.h
8 16
9
	movl $0, %ebx
17
	movl $0, %ebx # pass 0 as an argument
10 18
11
	int $0x80
19
	int $0x80     # 0x80 is the syscall interupt for the kernel