ARM64指令长度是32bit。
0000000000400608 :
400608: d10043ff sub sp, sp, #0x10
40060c: b9000fe0 str w0, [sp,#12]
400610: b9000be1 str w1, [sp,#8]
400614: b9400fe1 ldr w1, [sp,#12]
400618: b9400be0 ldr w0, [sp,#8]
40061c: 0b000020 add w0, w1, w0
400620: 910043ff add sp, sp, #0x10
400624: d65f03c0 ret
0000000000400628 :
400628: d10043ff sub sp, sp, #0x10
40062c: b9000fe0 str w0, [sp,#12]
400630: b9000be1 str w1, [sp,#8]
400634: b9400fe1 ldr w1, [sp,#12]
400638: b9400be0 ldr w0, [sp,#8]
40063c: 4b000020 sub w0, w1, w0
400640: 910043ff add sp, sp, #0x10
400644: d65f03c0 ret
0000000000400648 :
400648: a9bd7bfd stp x29, x30, [sp,#-48]! # 将fp,lr寄存器进栈
40064c: 910003fd mov x29, sp # 将sp寄存器赋值给fd。fp相当于ebp;
400650: b9002fbf str wzr, [x29,#44]
400654: 52800020 mov w0, #0x1 // #1
400658: b9002ba0 str w0, [x29,#40]
40065c: b9402ba1 ldr w1, [x29,#40]
400660: b9402fa0 ldr w0, [x29,#44]
400664: 97ffffe9 bl 400608
400668: b90027a0 str w0, [x29,#36]
40066c: b9402ba1 ldr w1, [x29,#40]
400670: b9402fa0 ldr w0, [x29,#44]
400674: 97ffffe5 bl 400608
400678: b90023a0 str w0, [x29,#32]
40067c: b9402ba1 ldr w1, [x29,#40]
400680: b9402fa0 ldr w0, [x29,#44]
400684: 97ffffe1 bl 400608
400688: b9001fa0 str w0, [x29,#28]
40068c: b9402ba1 ldr w1, [x29,#40]
400690: b9402fa0 ldr w0, [x29,#44]
400694: 97ffffdd bl 400608
400698: b9001ba0 str w0, [x29,#24]
40069c: b9402ba1 ldr w1, [x29,#40]
##lr寄存器
(gdb) info registers
x0 0x0 0
x1 0x1 1
x2 0xfffffffff488 281474976707720
x3 0x400648 4195912
x4 0x0 0
x5 0x0 0
x6 0xfffffffff470 281474976707696
x7 0x40 64
x8 0xffffffffffffffff -1
x9 0x3ffff 262143
x10 0x101010101010101 72340172838076673
x11 0x40 64
x12 0xffffbf6f2038 281473893474360
x13 0xffffbf6fefa8 281473893527464
x14 0x402 1026
x15 0x2 2
x16 0xffffbf568040 281473891860544
x17 0x410a08 4262408
x18 0xfffffffff260 281474976707168
x19 0x4006d0 4196048
x20 0x0 0
x21 0x0 0
x22 0x0 0
x23 0x0 0
x24 0x0 0
x25 0x0 0
x26 0x0 0
x27 0x0 0
x28 0x0 0
x29 0xfffffffff300 281474976707328
x30 0x400668 4195944
sp 0xfffffffff2f0 0xfffffffff2f0
pc 0x400614 0x400614
cpsr 0x60000000 1610612736
fpsr 0x0 0
fpcr 0x0 0
svc:arm上实现系统调用的指令
Eg:系统调用read的系统调用为63,通过x8寄存器传入
GCC6.1+版本支持:[Feature](https://www.mail-archive.com/[email protected]/msg509509.html)
Arm官方说明