OSDN Git Service

Remove the bogus exit status from _exit_with_stack_teardown.
authorElliott Hughes <enh@google.com>
Sat, 21 Dec 2013 23:30:49 +0000 (15:30 -0800)
committerElliott Hughes <enh@google.com>
Sat, 21 Dec 2013 23:30:49 +0000 (15:30 -0800)
It should always be 0, and there's no reason to pass a constant in as
an argument.

Change-Id: I92ac59b718a18e298bd7c52821af447f9181ca2a

libc/arch-aarch64/bionic/_exit_with_stack_teardown.S
libc/arch-arm/bionic/_exit_with_stack_teardown.S
libc/arch-mips/bionic/_exit_with_stack_teardown.S
libc/arch-x86/bionic/_exit_with_stack_teardown.S
libc/arch-x86_64/bionic/_exit_with_stack_teardown.S
libc/bionic/pthread_exit.cpp

index 083bcb6..d910821 100644 (file)
  * 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)
index 0d97f06..6fa950e 100644 (file)
  * 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)
index 9cab52b..ce05ab8 100644 (file)
 
        .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
index 03a4be0..e94ae90 100644 (file)
@@ -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)
index eca3b68..f7bc962 100644 (file)
  * 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)
index e6e636f..2692762 100644 (file)
@@ -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.