[parisc-linux] r19 (aka pic-register akak ltp) not restored on entry back to libc from libpthread?

James Bottomley James.Bottomley@steeleye.com
19 Sep 2003 13:26:44 -0500


On Fri, 2003-09-19 at 12:51, Carlos O'Donell wrote:
> mutex_unlock becomes:
> __libc_maybe_call (__pthread_mutex_unlock, (m), (*(int *)(m) = 0))

This seems all to work:

A test file

main() {
  int t1 = 4;
  __libc_maybe_call(test1, (t1), (t1=3));
}

compiles (PIC) to:

00000000 <main>:
[...]
 20:   2a 60 00 00     addil 0,r19,%r1
                        20: R_PARISC_DLTIND21L  .LC0
  24:   48 21 00 00     ldw 0(r1),r1
                        24: R_PARISC_DLTIND14R  .LC0
  28:   0c 20 10 94     ldw 0(,r1),r20
  2c:   0c 74 12 98     stw r20,c(,r3)
  30:   0c 78 10 94     ldw c(,r3),r20
  34:   86 80 20 3a     cmpib,=,n 0,r20,58 <main+0x58>
  38:   0c 78 10 94     ldw c(,r3),r20
  3c:   0c 70 10 9a     ldw 8(,r3),r26
  40:   08 14 02 56     copy r20,r22
  44:   08 13 02 44     copy r19,r4
  48:   eb e0 00 00     b,l 50 <main+0x50>,r31
                        48: R_PARISC_PCREL17F   $$dyncall
  4c:   08 1f 02 42     copy r31,rp
  50:   08 04 02 53     copy r4,r19
[...]
00000000 <.LC0>:
   0:   00 00 00 00     break 0,0
                        0: R_PARISC_PLABEL32    test1
[...]
00010578 <$$dyncall>:
   10578:	c7 d6 c0 12 	bb,>=,n r22,1e,10588 <$$dyncall+0x10>
   1057c:	d6 c0 1c 1e 	depwi 0,31,2,r22
   10580:	0e c8 10 93 	ldw 4(,r22),r19
   10584:	0e c0 10 96 	ldw 0(,r22),r22
   10588:	ea c0 c0 00 	bv r0(r22)
   1058c:	6b c2 3f d1 	stw rp,-18(sp)


The $$dyncall is where we indirect through r20 (which contains the
function pointer).  Note the copy restoring r19 around this.

James