summaryrefslogtreecommitdiff
path: root/libc/arch-x86/bionic/_exit_with_stack_teardown.S
blob: ce8c2ea0b49009b85f04d13d3f3a0a4a57f7cd91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <private/bionic_asm.h>

// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
ENTRY_PRIVATE(_exit_with_stack_teardown)
  // We can trash registers because this function never returns.
  mov 4(%esp), %ebx             // stackBase
  mov 8(%esp), %ecx             // stackSize
  mov $__NR_munmap, %eax
  int $0x80
  // If munmap failed, we ignore the failure and exit anyway.

  mov $0, %ebx                  // status
  movl $__NR_exit, %eax
  int $0x80
  // The exit syscall does not return.
END(_exit_with_stack_teardown)