Update cancellable assembly system call wrappers.
authorCarlos O'Donell <carlos@systemhalted.org>
Fri, 21 Oct 2011 14:08:04 +0000 (10:08 -0400)
committerCarlos O'Donell <carlos@systemhalted.org>
Fri, 21 Oct 2011 14:08:04 +0000 (10:08 -0400)
This patch updates sysdep-cancel.h to include the
new no-cancel wrapper and provides CFI directives
for all of the assembly. The CFI directives should
allow unwinding information to be generated.

Signed-off-by: Carlos O'Donell <carlos@sytemhalted.org>
ChangeLog.hppa
sysdeps/unix/sysv/linux/hppa/nptl/sysdep-cancel.h

index b83f4f0..564ca0f 100644 (file)
@@ -1,5 +1,24 @@
 2011-10-20  Carlos O'Donell  <carlos@systemhalted.org>
 
+       * sysdeps/unix/sysv/linux/hppa/nptl/sysdep-cancel.h: Update copyright 
+       year. 
+       (PSEUDO): Define __*_nocancel version. Add CFI directives to __*_nocancel
+       and normal version.
+       (PUSHARGS_1): Add CFI directive.
+       (PUSHARGS_2): Likewise.
+       (PUSHARGS_3): Likewise.
+       (PUSHARGS_4): Likewise.
+       (PUSHARGS_5): Likewise.
+       (PUSHARGS_6): Likewise.
+       (POPARGS_1): Likewise.
+       (POPARGS_2): Likewise.
+       (POPARGS_3): Likewise.
+       (POPARGS_4): Likewise.
+       (POPARGS_5): Likewise.
+       (POPARGS_6): Likewise.
+
+2011-10-20  Carlos O'Donell  <carlos@systemhalted.org>
+
        * sysdeps/unix/sysv/linux/hppa/linuxthreads/aio_cancel.c: Remove.
        * sysdeps/unix/sysv/linux/hppa/linuxthreads/bits/initspin.h: Remove.
        * sysdeps/unix/sysv/linux/hppa/linuxthreads/bits/pthreadtypes.h: Remove.
index 6cffa76..d704345 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
    
 # undef PSEUDO
 # define PSEUDO(name, syscall_name, args)                              \
+       ENTRY (__##syscall_name##_nocancel)                             \
+       DOARGS_##args                                   ASM_LINE_SEP    \
+       stwm TREG, 64(%sp)                              ASM_LINE_SEP    \
+       .cfi_offset TREG, 0                             ASM_LINE_SEP    \
+       .cfi_adjust_cfa_offset 64                       ASM_LINE_SEP    \
+       stw %sp, -4(%sp)                                ASM_LINE_SEP    \
+       .cfi_offset 30, -4                              ASM_LINE_SEP    \
+       stw %r19, -32(%sp)                              ASM_LINE_SEP    \
+       .cfi_offset 19, -32                             ASM_LINE_SEP    \
+       /* Save r19 */                                  ASM_LINE_SEP    \
+       SAVE_PIC(TREG)                                  ASM_LINE_SEP    \
+       /* Do syscall, delay loads # */                 ASM_LINE_SEP    \
+       ble  0x100(%sr2,%r0)                            ASM_LINE_SEP    \
+       ldi SYS_ify (syscall_name), %r20 /* delay */    ASM_LINE_SEP    \
+       ldi NO_ERROR,%r1                                ASM_LINE_SEP    \
+       cmpb,>>=,n %r1,%ret0,L(pre_nc_end)              ASM_LINE_SEP    \
+       /* Restore r19 from TREG */                     ASM_LINE_SEP    \
+       LOAD_PIC(TREG) /* delay */                      ASM_LINE_SEP    \
+       SYSCALL_ERROR_HANDLER                           ASM_LINE_SEP    \
+       /* Use TREG for temp storage */                 ASM_LINE_SEP    \
+       copy %ret0, TREG /* delay */                    ASM_LINE_SEP    \
+       /* OPTIMIZE: Don't reload r19 */                ASM_LINE_SEP    \
+       /* do a -1*syscall_ret0 */                      ASM_LINE_SEP    \
+       sub %r0, TREG, TREG                             ASM_LINE_SEP    \
+       /* Store into errno location */                 ASM_LINE_SEP    \
+       stw TREG, 0(%sr0,%ret0)                         ASM_LINE_SEP    \
+       /* return -1 as error */                        ASM_LINE_SEP    \
+       ldi -1, %ret0                                   ASM_LINE_SEP    \
+L(pre_nc_end):                                         ASM_LINE_SEP    \
+       /* No need to LOAD_PIC */                       ASM_LINE_SEP    \
+       /* Undo frame */                                ASM_LINE_SEP    \
+       ldwm -64(%sp),TREG                              ASM_LINE_SEP    \
+       .cfi_adjust_cfa_offset -64                      ASM_LINE_SEP    \
+       /* Restore rp before exit */                    ASM_LINE_SEP    \
+       ldw -20(%sp), %rp                               ASM_LINE_SEP    \
+       .cfi_restore 2                                  ASM_LINE_SEP    \
+       ret                                             ASM_LINE_SEP    \
+       END(__##syscall_name##_nocancel)                ASM_LINE_SEP    \
+       /**********************************************/ASM_LINE_SEP    \
        ENTRY (name)                                                    \
        DOARGS_##args                                   ASM_LINE_SEP    \
        stwm TREG, 64(%sp)                              ASM_LINE_SEP    \
+       .cfi_adjust_cfa_offset 64                       ASM_LINE_SEP    \
        stw %sp, -4(%sp)                                ASM_LINE_SEP    \
+       .cfi_offset 30, -4                              ASM_LINE_SEP    \
        stw %r19, -32(%sp)                              ASM_LINE_SEP    \
+       .cfi_offset 19, -32                             ASM_LINE_SEP    \
        /* Done setting up frame, continue... */        ASM_LINE_SEP    \
        SINGLE_THREAD_P                                 ASM_LINE_SEP    \
        cmpib,<>,n 0,%ret0,L(pseudo_cancel)             ASM_LINE_SEP    \
@@ -128,26 +170,40 @@ L(pre_end):                                               ASM_LINE_SEP    \
        /* No need to LOAD_PIC */                       ASM_LINE_SEP    \
        /* Undo frame */                                ASM_LINE_SEP    \
        ldwm -64(%sp),TREG                              ASM_LINE_SEP    \
+       .cfi_adjust_cfa_offset -64                      ASM_LINE_SEP    \
        /* Restore rp before exit */                    ASM_LINE_SEP    \
-       ldw -20(%sp), %rp                               ASM_LINE_SEP
+       ldw -20(%sp), %rp                               ASM_LINE_SEP    \
+       .cfi_restore 2                                  ASM_LINE_SEP
 
 /* Save arguments into our frame */
 # define PUSHARGS_0    /* nothing to do */
-# define PUSHARGS_1    PUSHARGS_0 stw %r26, -36(%sr0,%sp)      ASM_LINE_SEP
-# define PUSHARGS_2    PUSHARGS_1 stw %r25, -40(%sr0,%sp)      ASM_LINE_SEP
-# define PUSHARGS_3    PUSHARGS_2 stw %r24, -44(%sr0,%sp)      ASM_LINE_SEP
-# define PUSHARGS_4    PUSHARGS_3 stw %r23, -48(%sr0,%sp)      ASM_LINE_SEP
-# define PUSHARGS_5    PUSHARGS_4 stw %r22, -52(%sr0,%sp)      ASM_LINE_SEP 
-# define PUSHARGS_6    PUSHARGS_5 stw %r21, -56(%sr0,%sp)      ASM_LINE_SEP
+# define PUSHARGS_1    PUSHARGS_0 stw %r26, -36(%sr0,%sp)      ASM_LINE_SEP    \
+                       .cfi_offset 26, -36                     ASM_LINE_SEP
+# define PUSHARGS_2    PUSHARGS_1 stw %r25, -40(%sr0,%sp)      ASM_LINE_SEP    \
+                       .cfi_offset 25, -40                     ASM_LINE_SEP
+# define PUSHARGS_3    PUSHARGS_2 stw %r24, -44(%sr0,%sp)      ASM_LINE_SEP    \
+                       .cfi_offset 24, -44                     ASM_LINE_SEP
+# define PUSHARGS_4    PUSHARGS_3 stw %r23, -48(%sr0,%sp)      ASM_LINE_SEP    \
+                       .cfi_offset 23, -48                     ASM_LINE_SEP
+# define PUSHARGS_5    PUSHARGS_4 stw %r22, -52(%sr0,%sp)      ASM_LINE_SEP    \
+                       .cfi_offset 22, -52                     ASM_LINE_SEP
+# define PUSHARGS_6    PUSHARGS_5 stw %r21, -56(%sr0,%sp)      ASM_LINE_SEP    \
+                       .cfi_offset 21, -56                     ASM_LINE_SEP
 
 /* Bring them back from the stack */
 # define POPARGS_0     /* nothing to do */
-# define POPARGS_1     POPARGS_0 ldw -36(%sr0,%sp), %r26       ASM_LINE_SEP
-# define POPARGS_2     POPARGS_1 ldw -40(%sr0,%sp), %r25       ASM_LINE_SEP
-# define POPARGS_3     POPARGS_2 ldw -44(%sr0,%sp), %r24       ASM_LINE_SEP
-# define POPARGS_4     POPARGS_3 ldw -48(%sr0,%sp), %r23       ASM_LINE_SEP
-# define POPARGS_5     POPARGS_4 ldw -52(%sr0,%sp), %r22       ASM_LINE_SEP
-# define POPARGS_6     POPARGS_5 ldw -56(%sr0,%sp), %r21       ASM_LINE_SEP
+# define POPARGS_1     POPARGS_0 ldw -36(%sr0,%sp), %r26       ASM_LINE_SEP    \
+                       .cfi_restore 26                         ASM_LINE_SEP
+# define POPARGS_2     POPARGS_1 ldw -40(%sr0,%sp), %r25       ASM_LINE_SEP    \
+                       .cfi_restore 25                         ASM_LINE_SEP
+# define POPARGS_3     POPARGS_2 ldw -44(%sr0,%sp), %r24       ASM_LINE_SEP    \
+                       .cfi_restore 24                         ASM_LINE_SEP
+# define POPARGS_4     POPARGS_3 ldw -48(%sr0,%sp), %r23       ASM_LINE_SEP    \
+                       .cfi_restore 23                         ASM_LINE_SEP
+# define POPARGS_5     POPARGS_4 ldw -52(%sr0,%sp), %r22       ASM_LINE_SEP    \
+                       .cfi_restore 22                         ASM_LINE_SEP
+# define POPARGS_6     POPARGS_5 ldw -56(%sr0,%sp), %r21       ASM_LINE_SEP    \
+                       .cfi_restore 21                         ASM_LINE_SEP
 
 # ifdef IS_IN_libpthread
 #  ifdef PIC