(PSEUDO_RET): Correctly unstack lr.
authordrepper <drepper>
Sun, 12 Jan 2003 09:14:25 +0000 (09:14 +0000)
committerdrepper <drepper>
Sun, 12 Jan 2003 09:14:25 +0000 (09:14 +0000)
(UNDOARGS_5): Fix ordering of pushes and pops.
(SINGLE_THREAD_P_PIC): New.
(SINGLE_THREAD_P_INT): Likewise.
(SINGLE_THREAD_P): Implement in terms of above.  Restore lr if it was stacked.
(PSEUDO): Use SINGLE_THREAD_P_INT.

linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h

index 5f3709f..38e472d 100644 (file)
@@ -27,6 +27,7 @@
 # undef PSEUDO_RET
 # define PSEUDO_RET                                                    \
     ldrcc pc, [sp], $4;                                                        \
+    ldr        lr, [sp], $4;                                                   \
     b PLTJMP(SYSCALL_ERROR)
 
 # undef PSEUDO
@@ -34,7 +35,7 @@
   .section ".text";                                                    \
     PSEUDO_PROLOGUE;                                                   \
   ENTRY (name)                                                         \
-    SINGLE_THREAD_P;                                                   \
+    SINGLE_THREAD_P_INT;                                               \
     bne .Lpseudo_cancel;                                               \
     DO_CALL (syscall_name, args);                                      \
     cmn r0, $4096;                                                     \
@@ -74,7 +75,7 @@
 # define UNDOC2ARGS_4
 
 # define DOCARGS_5     stmfd sp!, {r0-r3}
-# define UNDOCARGS_5   str r4, [sp, #-4]!; ldmfd sp, {r0-r4}
+# define UNDOCARGS_5   ldmfd sp, {r0-r3}; str r4, [sp, #-4]!; ldr r4, [sp, #24]
 # define UNDOC2ARGS_5   ldr r4, [sp], #20
 
 # ifdef IS_IN_libpthread
@@ -92,10 +93,11 @@ extern int __local_multiple_threads attribute_hidden;
 #  define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
 # else
 #  if !defined PIC
-#   define SINGLE_THREAD_P                                             \
+#   define SINGLE_THREAD_P_INT                                         \
   ldr ip, =__local_multiple_threads;                                   \
   ldr ip, [ip];                                                                \
   teq ip, #0;
+#   define SINGLE_THREAD_P SINGLE_THREAD_P_INT
 #   define MAYBE_SAVE_LR                                               \
   str lr, [sp, $-4]!;
 #   define PSEUDO_RET_MOV                                              \
@@ -103,14 +105,19 @@ extern int __local_multiple_threads attribute_hidden;
   b PLTJMP(SYSCALL_ERROR)
 #   define PSEUDO_PROLOGUE
 #  else
-#   define SINGLE_THREAD_P                                             \
-  str lr, [sp, $-4]!;                                                  \
+#   define SINGLE_THREAD_P_PIC(reg)                                    \
   ldr ip, 1b;                                                          \
-  ldr lr, 2b;                                                          \
+  ldr reg, 2b;                                                         \
 3:                                                                     \
   add ip, pc, ip;                                                      \
   ldr ip, [ip, lr];                                                    \
   teq ip, #0;
+#   define SINGLE_THREAD_P_INT                                         \
+  str lr, [sp, $-4]!;                                                  \
+  SINGLE_THREAD_P_PIC(lr)
+#   define SINGLE_THREAD_P                                             \
+  SINGLE_THREAD_P_INT;                                                 \
+  ldr lr, [sp], $4
 #   define PSEUDO_PROLOGUE                                             \
   1:  .word _GLOBAL_OFFSET_TABLE_ - 3f - 8;                            \
   2:  .word __local_multiple_threads(GOTOFF);