Rev 1693 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1693 | Rev 1906 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | .section .init |
1 | .section .init |
Line 2... | Line 2... | ||
2 | 2 | ||
3 | .global __start |
- | |
4 | .global __exit |
- | |
Line 5... | Line 3... | ||
5 | .global __Exit |
3 | .global __start |
6 | 4 | ||
7 | .align 4 |
5 | .align 4 |
8 | __start: |
6 | __start: |
Line 18... | Line 16... | ||
18 | addl %eax, %ecx |
16 | addl %eax, %ecx |
19 | movl %eax, %fs:4 |
17 | movl %eax, %fs:4 |
20 | movl %ecx, %fs:8 #save stack base - low limit |
18 | movl %ecx, %fs:8 #save stack base - low limit |
21 | #save stack top - high limit |
19 | #save stack top - high limit |
- | 20 | movl %ecx, %esp #reload stack |
|
- | 21 | ||
- | 22 | subl $1024, %esp |
|
- | 23 | ||
- | 24 | movl $9, %eax |
|
22 | movl %ecx, %esp |
25 | movl %esp, %ebx |
- | 26 | movl $-1, %ecx |
|
- | 27 | int $0x40 |
|
- | 28 | ||
- | 29 | movl 30(%ebx), %eax |
|
- | 30 | movl %eax, %fs:0 #save pid |
|
- | 31 | ||
- | 32 | movl $__tls_map, %edi #init TLS |
|
- | 33 | movl $32, %ecx |
|
- | 34 | xorl %eax, %eax |
|
- | 35 | notl %eax |
|
- | 36 | ||
- | 37 | rep |
|
- | 38 | stosl |
|
- | 39 | ||
- | 40 | movb $0xF0, __tls_map |
|
23 | jmp ___crt_startup #reload stack |
41 | jmp ___crt_startup |
24 | 1: |
42 | 1: |
25 | int3 #trap to debugger |
43 | int3 #trap to debugger |
Line 26... | Line 44... | ||
26 | 44 | ||
Line 27... | Line -... | ||
27 | .ascii "No enough memory for stack allocation" |
- | |
28 | - | ||
29 | .align 4 |
- | |
30 | __exit: |
- | |
31 | __Exit: |
- | |
32 | movl 4(%esp), %edx #store exit code |
- | |
33 | movl $68, %eax |
- | |
34 | movl $13, %ebx |
- | |
35 | movl %fs:4, %ecx |
- | |
36 | int $0x40 #destroy stack |
- | |
37 | - |