之前说过学习汇编就是学习寄存器和指令,查看代码请连接真机。
寄存器
在arm64
汇编中寄存器是64
bit的,使用X[n]
表示,低32位以w[n]
表示

在64
位架构中有31
个64
位的通用寄存器。
可以通过register read
查看
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
(lldb) register read General Purpose Registers: x0 = 0x0000000000000001 x1 = 0x00000002805d8a20 x2 = 0x00000002837e7980 x3 = 0x00000002805d8a20 x4 = 0x0000000000000001 x5 = 0x0000000000000001 x6 = 0x0000000100d54000 x7 = 0x0000000000000000 x8 = 0x0000200000000000 x9 = 0x000161a1d63f7945 (0x00000001d63f7945) (void *)0x01d63f7cb0000001 x10 = 0x0000000000000000 x11 = 0x000000000000006d x12 = 0x000000000000006d x13 = 0x0000000000000000 x14 = 0x0000000000000000 x15 = 0x00000001ca634e6d "touchesBegan:withEvent:" x16 = 0x000000019c4cd47c libobjc.A.dylib`objc_storeStrong x17 = 0x0000000000000000 x18 = 0x0000000000000000 x19 = 0x0000000100f17810 x20 = 0x00000002837e7920 x21 = 0x00000002805d8a20 x22 = 0x00000001ca634e6d "touchesBegan:withEvent:" x23 = 0x0000000100e11a30 x24 = 0x00000002837e7980 x25 = 0x0000000100e11a30 x26 = 0x00000002805d8a20 x27 = 0x00000001ca62d900 "countByEnumeratingWithState:objects:count:" x28 = 0x00000002805d8a20 fp = 0x000000016f47d730 lr = 0x00000001009866dc ArmAssembly`-[ViewController touchesBegan:withEvent:] + 84 at ViewController.m:38 sp = 0x000000016f47d720 pc = 0x0000000100986720 ArmAssembly`foo1 + 16 at ViewController.m:46 cpsr = 0x80000000 (lldb) |