Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] interesting linker behaviour :)
@ 2004-09-21 17:22 Randolph Chung
  2004-09-21 17:43 ` Carlos O'Donell
  0 siblings, 1 reply; 11+ messages in thread
From: Randolph Chung @ 2004-09-21 17:22 UTC (permalink / raw)
  To: parisc-linux

willy found a problem this morning with the exception code which was
traced down to the following:

the following code comes from lusercopy.S (with macros expanded):

lstrncpy_from_user:
        .proc
        .callinfo NO_CALLS
        .entry
        comib,=     0,%r24,$lsfu_done
        copy        %r24,%r23
        get_sr
1:      ldbs,ma     1(%sr1,%r25),%r1
$lsfu_loop:
        stbs,ma     %r1,1(%r26)
        comib,=,n   0,%r1,$lsfu_done
        addib,<>,n  -1,%r24,$lsfu_loop
2:      ldbs,ma     1(%sr1,%r25),%r1
$lsfu_done:
        sub         %r23,%r24,%r28
$lsfu_exit:
        bv          %r0(%r2)
        nop
        .exit

        .section .fixup,"ax"
3:      b $lsfu_exit
        ldi         -EFAULT,%r28
        .previous

        .section __ex_table,"aw"
        .word       1b,3b
        .word       2b,3b
        .previous

        .procend

what is supposed to happen is that when a fault happens at "1:", we
would branch to "3:". The code in "3:" sets the return value to -EFAULT
and branches back to the exit path.

what we observed was that when a fault happens, we get an endless loop
of faults.

when i disassembled the code at 3:, i see:

1038ce68:       e8 05 00 7d     b,l 10357eac <tcpdiag_dump+0x5ac>,r0
1038ce6c:       34 1c 3f e5     ldi -e,ret0

the target of the branch is a long branch stub:

10357eac:       20 20 02 02     ldil 10100000,r1
10357eb0:       e0 20 22 b2     be,n 158(sr4,r1)

but 10100158 is lstrncpy_from_user, not $lsfu_exit:
10100158 <lstrncpy_from_user>
10100190 <$lsfu_exit>

i wonder if the sections are somehow confusing things.... this is with
fairly recent gcc/binutils toolchains, for 32-bit.

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-09-21 22:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-21 17:22 [parisc-linux] interesting linker behaviour :) Randolph Chung
2004-09-21 17:43 ` Carlos O'Donell
2004-09-21 17:46   ` Carlos O'Donell
2004-09-21 18:51   ` John David Anglin
2004-09-21 19:49     ` Randolph Chung
2004-09-21 20:06       ` John David Anglin
2004-09-21 20:20       ` John David Anglin
2004-09-21 20:36         ` Randolph Chung
2004-09-21 22:04     ` Carlos O'Donell
2004-09-21 22:19       ` Carlos O'Donell
2004-09-21 22:21       ` John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox