diff options
Diffstat (limited to 'com32/lib/sys/exit.S')
-rw-r--r-- | com32/lib/sys/exit.S | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/com32/lib/sys/exit.S b/com32/lib/sys/exit.S new file mode 100644 index 00000000..76c8b5da --- /dev/null +++ b/com32/lib/sys/exit.S @@ -0,0 +1,27 @@ +# $Id$ +# +# Implementation of _exit() for com32 based on c32entry.S +# + .text + .globl _exit + .type _exit, @function +_exit: + # Run any destructors + movl $__dtors_start, %esi +2: + cmpl $__dtors_end, %esi + jae 1f + call *(%esi) + addl $4,%esi + jmp 2b + +1: + movl 4(%esp),%eax # Exit code in %eax = return value + movl (__entry_esp),%esp # Return stack pointer to entry value + ret # Return to termination address + .size _exit, .-_exit + + .data +__exit_handler: + .globl __exit_handler + .long _exit |