aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-11-26 13:48:24 -0800
committerElliott Hughes <enh@google.com>2013-11-26 13:48:24 -0800
commit9dec707bd6fa59849c205db6f878f1b2cc2de536 (patch)
treee7e48a8ac0473a0e2bfc30b611390a9c9ab3c642
parenta98fff25c33b2cb697c6bf75b3d17612427b6db3 (diff)
downloadbionic-9dec707bd6fa59849c205db6f878f1b2cc2de536.tar.gz
Fix _exit_with_stack_teardown for x86.
Change-Id: Ife8f9c538c86f7c0017143015d5ee849a99b625b
-rw-r--r--libc/arch-x86/bionic/_exit_with_stack_teardown.S3
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/arch-x86/bionic/_exit_with_stack_teardown.S b/libc/arch-x86/bionic/_exit_with_stack_teardown.S
index 9128f10d8..03a4be02b 100644
--- a/libc/arch-x86/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-x86/bionic/_exit_with_stack_teardown.S
@@ -3,12 +3,13 @@
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
ENTRY(_exit_with_stack_teardown)
- // We can trash %ebx here since this call should never return.
+ // We can trash registers because this function never returns.
// We can also take advantage of the fact that the linux syscall trap
// handler saves all the registers, so we don't need a stack to keep
// the status argument for exit while doing the munmap.
mov 4(%esp), %ebx // stackBase
mov 8(%esp), %ecx // stackSize
+ mov 12(%esp), %edx // Also copy 'status' off the stack we're about to unmap.
mov $__NR_munmap, %eax
int $0x80
// If munmap failed, we ignore the failure and exit anyway.