Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PowerPC assembl question



Well, here is my piece of code:

.globl   _C_LABEL(linux_execcode_start)
.globl   _C_LABEL(linux_execcode_end)
.globl   _C_LABEL(linux_execcode_target)
_C_LABEL(linux_execcode_start):
   addi     1,1,0x10
   lis      11, _C_LABEL(linux_execcode_target)@ha
   lwz      12, _C_LABEL(linux_execcode_target)@l(11)
   mtctr    12
   bctr
_C_LABEL(linux_execcode_target):
.long    0      /* Setup at run time by kernel */
_C_LABEL(linux_execcode_end):


When I try to run it, I get a SIGSEGV. Disassembling in gdb produces
this:
(gdb) x/10xi 0x7fffe930
0x7fffe930:     addi    r1,r1,16
0x7fffe934:     lis     r11,46
0x7fffe938:     lwz     r12,-1664(r11)
0x7fffe93c:     mtctr   r12
0x7fffe940:     bctr
0x7fffe944:     .long 0x1800514

It's the lwz instruction that causes the SIGSEGV. Obviously, I did not
get what I expected at link time. I think I should have had something
like this:
        addi    r1,r1,16
        lis     r11,16(pc)
        lwz     r12,0(r11)
        mtctr   r12
        bctr
        .long   0x1800514

What went wrong?

-- 
Emmanuel Dreyfus.   
Il ne suffit pas de crier l'iMac, l'iMac! en sautant comme un cabri...
p99dreyf%criens.u-psud.fr@localhost



Home | Main Index | Thread Index | Old Index