func()1 void func() {
2
3 #ifdef __powerpc64__
4 __asm__ (
5 "mflr 0;"
6 "std 0,16(1);"
7 "addi 1,1,-24;"
8 "mr 31,1;"
9 ".cfi_def_cfa_offset 24;"
10 "addi 0,0,0;"
11 "addi 1,1,24;"
12 "ld 0,16(1);"
13 ".cfi_def_cfa_offset 0;"
14 );
15 #elif !defined __mips__
16 __asm__ (
17 "pushq $0x10;"
18 ".cfi_def_cfa_offset 16;"
19 "jmp label;"
20 "movq $0x48, %rax;"
21 "label: subq $0x38, %rax;"
22 "movq $0x48, %rcx;"
23 "movq $0x48, %rdx;"
24 "movq $0x48, %rax;"
25 "popq %rax;"
26 );
27 #elif __mips64
28 __asm__ (
29 "daddiu $sp,$sp,-16;"
30 ".cfi_def_cfa_offset 16;"
31 "sd $ra,8($sp);"
32 ".cfi_offset 31, -8;"
33 "daddiu $ra,$zero,0;"
34 "ld $ra,8($sp);"
35 "daddiu $sp, $sp,16;"
36 ".cfi_restore 31;"
37 ".cfi_def_cfa_offset 0;"
38 );
39 #else
40 // For MIPS32
41 __asm__ (
42 "addiu $sp,$sp,-8;"
43 ".cfi_def_cfa_offset 8;"
44 "sw $ra,4($sp);"
45 ".cfi_offset 31, -4;"
46 "addiu $ra,$zero,0;"
47 "lw $ra,4($sp);"
48 "addiu $sp,$sp,8;"
49 ".cfi_restore 31;"
50 ".cfi_def_cfa_offset 0;"
51 );
52 #endif
53 }
54
main(int argc,char const * argv[])55 int main(int argc, char const *argv[])
56 {
57 func();
58 }
59