Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1693 | serge | 1 | |
2 | |||
3 | |||
4 | .global __exit |
||
5 | .global __Exit |
||
6 | |||
7 | |||
8 | __start: |
||
9 | movl $68, %eax |
||
10 | movl $12, %ebx |
||
11 | lea __size_of_stack_reserve__, %ecx |
||
12 | addl $4095, %ecx #load stack size |
||
13 | andl $-4096, %ecx #align to page granularity |
||
14 | int $0x40 #and allocate |
||
15 | testl %eax, %eax |
||
16 | jz 1f |
||
17 | |||
18 | |||
19 | movl %eax, %fs:4 |
||
20 | movl %ecx, %fs:8 #save stack base - low limit |
||
21 | #save stack top - high limit |
||
22 | movl %ecx, %esp |
||
23 | jmp ___crt_startup #reload stack |
||
24 | 1: |
||
25 | int3 #trap to debugger |
||
26 | |||
27 | |||
28 | |||
29 | |||
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 | |||
38 | |||
39 | int $0x40 #terminate thread |
||
40 |