This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] hppa clone.S
- From: Carlos O'Donell <carlos at baldric dot uwo dot ca>
- To: libc-alpha <libc-alpha at sources dot redhat dot com>
- Date: Thu, 18 Dec 2003 00:33:46 -0500
- Subject: [PATCH] hppa clone.S
libc-alpha,
Save and restore call clobbered PIC register in assembly clone call,
but only if we have to make a subsequent function call (e.g. error
condition). I also cleanup the assembly by loading with sr0 from the
stack.
c.
2003-12-18 Carlos O'Donell <carlos@baldric.uwo.ca>
* sysdeps/unix/sysv/linux/hppa/clone.S (__clone) [PIC]: Save PIC,
reload PIC if we need to call __syscall_error, cleanup asm.
--- libc-orig/sysdeps/unix/sysv/linux/hppa/clone.S 2001-07-06 00:56:15.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/hppa/clone.S 2003-12-17 21:57:25.000000000 -0500
@@ -42,6 +42,11 @@
stwm %arg0,64(%arg1)
stw %arg3,-60(%arg1)
+ /* Save the PIC register. */
+#ifdef PIC
+ stw %r19,-32(%sr0, %sp) /* parent */
+#endif
+
/* Do the system call */
copy %arg2,%arg0
ble 0x100(%sr2,%r0)
@@ -53,19 +58,31 @@
comib,=,n 0,%ret0,thread_start
- /* Successful return from the parent */
+ /* Successful return from the parent
+ No need to restore the PIC register,
+ since we return immediately. */
+
bv %r0(%rp)
nop
/* Something bad happened -- no child created */
.Lerror:
+
+ /* Restore the PIC register on error */
+#ifdef PIC
+ ldw -32(%sr0, %sp), %r19 /* parent */
+#endif
+
b __syscall_error
sub %r0,%ret0,%arg0
thread_start:
+
/* Load up the arguments. */
- ldw -60(%sp),%arg0
- ldw -64(%sp),%r22
+ ldw -60(%sr0, %sp),%arg0
+ ldw -64(%sr0, %sp),%r22
+
+ /* $$dyncall fixes childs PIC register */
/* Call the user's function */
bl $$dyncall,%r31