am 47033433
: Merge "Remove the bogus exit status from _exit_with_stack_teardown."
* commit '470334333e2ad5119b72bb830c51c32852a77c6c': Remove the bogus exit status from _exit_with_stack_teardown.
This commit is contained in:
commit
2f6f6c0b8e
@ -26,18 +26,16 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <asm/unistd.h>
|
||||
#include <machine/asm.h>
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
|
||||
ENTRY(_exit_with_stack_teardown)
|
||||
mov w28, w2
|
||||
mov w8, __NR_munmap
|
||||
svc #0
|
||||
mov w8, __NR_munmap
|
||||
svc #0
|
||||
// If munmap failed, we ignore the failure and exit anyway.
|
||||
|
||||
sxtw x0, w28
|
||||
mov w8, __NR_exit
|
||||
svc #0
|
||||
mov x0, #0
|
||||
mov w8, __NR_exit
|
||||
svc #0
|
||||
// The exit syscall does not return.
|
||||
END(_exit_with_stack_teardown)
|
||||
|
@ -26,18 +26,16 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
|
||||
ENTRY(_exit_with_stack_teardown)
|
||||
mov lr, r2
|
||||
ldr r7, =__NR_munmap
|
||||
swi #0
|
||||
// If munmap failed, we ignore the failure and exit anyway.
|
||||
ldr r7, =__NR_munmap
|
||||
swi #0
|
||||
// If munmap failed, we ignore the failure and exit anyway.
|
||||
|
||||
mov r0, lr
|
||||
ldr r7, =__NR_exit
|
||||
swi #0
|
||||
// The exit syscall does not return.
|
||||
mov r0, #0
|
||||
ldr r7, =__NR_exit
|
||||
swi #0
|
||||
// The exit syscall does not return.
|
||||
END(_exit_with_stack_teardown)
|
||||
|
@ -30,21 +30,19 @@
|
||||
|
||||
.text
|
||||
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
|
||||
|
||||
.type _exit_with_stack_teardown, @function
|
||||
.global _exit_with_stack_teardown
|
||||
.align 4
|
||||
.ent _exit_with_stack_teardown
|
||||
_exit_with_stack_teardown:
|
||||
move $s0,$a2 /* preserve status for exit() call */
|
||||
|
||||
li $v0,__NR_munmap
|
||||
li $v0, __NR_munmap
|
||||
syscall
|
||||
// If munmap failed, we ignore the failure and exit anyway.
|
||||
|
||||
move $a0,$s0
|
||||
li $v0,__NR_exit
|
||||
move $a0, 0
|
||||
li $v0, __NR_exit
|
||||
syscall
|
||||
// The exit syscall does not return.
|
||||
.end _exit_with_stack_teardown
|
||||
|
@ -1,21 +1,16 @@
|
||||
#include <asm/unistd.h>
|
||||
#include <machine/asm.h>
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
|
||||
ENTRY(_exit_with_stack_teardown)
|
||||
// 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.
|
||||
// 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 %edx, %ebx // status
|
||||
movl $__NR_exit, %eax
|
||||
int $0x80
|
||||
// The exit syscall does not return.
|
||||
mov $0, %ebx // status
|
||||
movl $__NR_exit, %eax
|
||||
int $0x80
|
||||
// The exit syscall does not return.
|
||||
END(_exit_with_stack_teardown)
|
||||
|
@ -26,20 +26,16 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <asm/unistd.h>
|
||||
#include <machine/asm.h>
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
|
||||
// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
|
||||
ENTRY(_exit_with_stack_teardown)
|
||||
// We take advantage of the fact that the linux syscall trap
|
||||
// handler saves all the registers, so we don't need to save
|
||||
// the status argument for exit(2) while doing the munmap(2).
|
||||
mov $__NR_munmap, %eax
|
||||
syscall
|
||||
// If munmap failed, we ignore the failure and exit anyway.
|
||||
mov $__NR_munmap, %eax
|
||||
syscall
|
||||
// If munmap failed, we ignore the failure and exit anyway.
|
||||
|
||||
mov %rdx, %rdi // status
|
||||
mov $__NR_exit, %eax
|
||||
syscall
|
||||
// The exit syscall does not return.
|
||||
mov $0, %rdi
|
||||
mov $__NR_exit, %eax
|
||||
syscall
|
||||
// The exit syscall does not return.
|
||||
END(_exit_with_stack_teardown)
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "pthread_internal.h"
|
||||
|
||||
extern "C" void _exit_with_stack_teardown(void*, size_t, int);
|
||||
extern "C" void _exit_with_stack_teardown(void*, size_t);
|
||||
extern "C" void __exit(int);
|
||||
extern "C" int __set_tid_address(int*);
|
||||
|
||||
@ -125,7 +125,7 @@ void pthread_exit(void* return_value) {
|
||||
sigfillset(&mask);
|
||||
sigprocmask(SIG_SETMASK, &mask, NULL);
|
||||
|
||||
_exit_with_stack_teardown(stack_base, stack_size, 0);
|
||||
_exit_with_stack_teardown(stack_base, stack_size);
|
||||
}
|
||||
|
||||
// NOTREACHED, but we told the compiler this function is noreturn, and it doesn't believe us.
|
||||
|
Loading…
Reference in New Issue
Block a user