[Libre-soc-bugs] [Bug 982] Support PowerPC ABI in ISACaller

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Sep 6 00:44:03 BST 2023


https://bugs.libre-soc.org/show_bug.cgi?id=982

--- Comment #14 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char *argv[] ) {
    write(1, "hello\n", 6);
    return 0;
}

==>

0000000010000974 <.main>:
    10000974:   7c 08 02 a6     mflr    r0
    10000978:   f8 01 00 10     std     r0,16(r1)
    1000097c:   fb e1 ff f8     std     r31,-8(r1)
    10000980:   f8 21 ff 81     stdu    r1,-128(r1)
    10000984:   7c 3f 0b 78     mr      r31,r1
    10000988:   7c 69 1b 78     mr      r9,r3
    1000098c:   f8 9f 00 b8     std     r4,184(r31)
    10000990:   91 3f 00 b0     stw     r9,176(r31)
    10000994:   38 a0 00 06     li      r5,6
    10000998:   3c 82 ff fb     addis   r4,r2,-5
    1000099c:   38 84 76 68     addi    r4,r4,30312
    100009a0:   38 60 00 01     li      r3,1
    100009a4:   48 02 16 1d     bl      10021fc0 <.__libc_write>
    100009a8:   60 00 00 00     nop
    100009ac:   39 20 00 00     li      r9,0
    100009b0:   7d 23 4b 78     mr      r3,r9
    100009b4:   38 3f 00 80     addi    r1,r31,128
    100009b8:   e8 01 00 10     ld      r0,16(r1)
    100009bc:   7c 08 03 a6     mtlr    r0
    100009c0:   eb e1 ff f8     ld      r31,-8(r1)
    100009c4:   4e 80 00 20     blr
    100009c8:   00 00 00 00     .long 0x0
    100009cc:   00 00 00 01     .long 0x1
    100009d0:   80 01 00 01     lwz     r0,1(r1)
    100009d4:   60 00 00 00     nop
    100009d8:   60 00 00 00     nop
    100009dc:   60 00 00 00     nop

and i bet you if you replace that "bl __libc_write" with "sc"
directly in assembler you'll end up with "hello" on the terminal.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list