#include <stdio.h>
int main()
{
printf("a=%d, b=%d, c=%d, %d, %d, %d, %d, %d\n",
1, 2, 3, 4, 5, 6, 7, 8);
return 0;
}
#if 0
/*
* arm 传递8个参数
*/
win64 使用RCX, RDX, R8, R9传递前4个参数,其余的参数使用栈来传递。
/*
* arm
*/
#endif
#if 0
/*
* intel
*/
0000000000001149 <main>:
1149: f3 0f 1e fa endbr64
114d: 55 push %rbp
114e: 48 89 e5 mov %rsp,%rbp
1151: 48 83 ec 08 sub $0x8,%rsp
1155: 6a 08 pushq $0x8
1157: 6a 07 pushq $0x7
1159: 6a 06 pushq $0x6
115b: 41 b9 05 00 00 00 mov $0x5,%r9d
1161: 41 b8 04 00 00 00 mov $0x4,%r8d
1167: b9 03 00 00 00 mov $0x3,%ecx
116c: ba 02 00 00 00 mov $0x2,%edx
1171: be 01 00 00 00 mov $0x1,%esi
1176: 48 8d 3d 8b 0e 00 00 lea 0xe8b(%rip),%rdi # 2008 <_IO_stdin_used+0x8>
117d: b8 00 00 00 00 mov $0x0,%eax
1182: e8 c9 fe ff ff callq 1050 <printf@plt> // printf(rdi, esi, edx, ecx, r8d, r9d, rsp, rsp-0x8, rsp-0x10)
1187: 48 83 c4 20 add $0x20,%rsp
118b: b8 00 00 00 00 mov $0x0,%eax
1190: c9 leaveq
1191: c3 retq
1192: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
1199: 00 00 00
119c: 0f 1f 40 00 nopl 0x0(%rax)
/*
* arm
*/
000000000040055c <main>:
40055c: d10083ff sub sp, sp, #0x20
400560: a9017bfd stp x29, x30, [sp, #16]
400564: 910043fd add x29, sp, #0x10
400568: 90000000 adrp x0, 400000 <_init-0x3e8>
40056c: 91198008 add x8, x0, #0x660
400570: 52800100 mov w0, #0x8 // #8
400574: b90003e0 str w0, [sp]
400578: 528000e7 mov w7, #0x7 // #7
40057c: 528000c6 mov w6, #0x6 // #6
400580: 528000a5 mov w5, #0x5 // #5
400584: 52800084 mov w4, #0x4 // #4
400588: 52800063 mov w3, #0x3 // #3
40058c: 52800042 mov w2, #0x2 // #2
400590: 52800021 mov w1, #0x1 // #1
400594: aa0803e0 mov x0, x8
400598: 97ffffae bl 400450 <printf@plt> // printf(x0, w1, w2, w3, w4, w5, w6, w7, sp)
40059c: 52800000 mov w0, #0x0 // #0
4005a0: a9417bfd ldp x29, x30, [sp, #16]
4005a4: 910083ff add sp, sp, #0x20
4005a8: d65f03c0 ret
#endif