#include
int main()
{
printf("a=%d, b=%d, c=%d, %d, %d, %d, %d, %d, %d\n",
1, 2, 3, 4, 5, 6, 7, 8, 9);
return 0;
}
#if 0
/*
* x64 传递9个参数
*/
win64 使用RCX, RDX, R8, R9传递前4个参数,其余的参数使用栈来传递。
#endif
#if 0
/*
* intel
*/
0000000000001149 :
1149: f3 0f 1e fa endbr64
114d: 55 push %rbp
114e: 48 89 e5 mov %rsp,%rbp
1151: 6a 09 pushq $0x9
1153: 6a 08 pushq $0x8
1155: 6a 07 pushq $0x7
1157: 6a 06 pushq $0x6
1159: 41 b9 05 00 00 00 mov $0x5,%r9d
115f: 41 b8 04 00 00 00 mov $0x4,%r8d
1165: b9 03 00 00 00 mov $0x3,%ecx
116a: ba 02 00 00 00 mov $0x2,%edx
116f: be 01 00 00 00 mov $0x1,%esi
1174: 48 8d 3d 8d 0e 00 00 lea 0xe8d(%rip),%rdi # 2008 <_IO_stdin_used+0x8>
117b: b8 00 00 00 00 mov $0x0,%eax
1180: e8 cb fe ff ff callq 1050 // printf(rdi, esi, edx, ecx, r8d, r9d, rsp, rsp-0x8, rsp-0x10, rsp-0x18)
1185: 48 83 c4 20 add $0x20,%rsp
1189: b8 00 00 00 00 mov $0x0,%eax
118e: c9 leaveq
118f: c3 retq
/*
* arm
*/
000000000040055c :
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: 9119a008 add x8, x0, #0x668
400570: 52800120 mov w0, #0x9 // #9
400574: b9000be0 str w0, [sp, #8]
400578: 52800100 mov w0, #0x8 // #8
40057c: b90003e0 str w0, [sp]
400580: 528000e7 mov w7, #0x7 // #7
400584: 528000c6 mov w6, #0x6 // #6
400588: 528000a5 mov w5, #0x5 // #5
40058c: 52800084 mov w4, #0x4 // #4
400590: 52800063 mov w3, #0x3 // #3
400594: 52800042 mov w2, #0x2 // #2
400598: 52800021 mov w1, #0x1 // #1
40059c: aa0803e0 mov x0, x8
4005a0: 97ffffac bl 400450 // printf(x0, w1, w2, w3, w4, w5, w6, w7, sp, sp+8)
4005a4: 52800000 mov w0, #0x0 // #0
4005a8: a9417bfd ldp x29, x30, [sp, #16]
4005ac: 910083ff add sp, sp, #0x20
4005b0: d65f03c0 ret
#endif