ARM Assembly
Local labels
Local labels are a subclass of label. A local label is a number in the range 0-99, optionally followed by a name. Unlike other labels, a local label can be defined many times and the same number can be used for more than one local label in an area.
Ref: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/Caccjfff.html
AArch64 identification registers
Registers in AArch64 state
r0 - r31
是 32 個通用暫存器- 使用
x1 - x30
會拿到 64-bits ,使用w0 - w30
會拿到 Lower 32-bits x31
不直接存取- 使用
xzr/wzr
來存取即是 zero register - 使用
sp/wsp
來存取即是 stack pointer
- 使用
Ref: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0801a/BABBGCAC.html
副檔名 .s 與 .S 差異
副檔名取 .s 可能會導致找不到 symbol
GNU Inline Assembly
asm volatile ("mrs %0, cntfrq_el0" : "=r"(f));
Instructions
eret
Exception Return.
svc
Supervisor calls are normally used to request privileged operations or access to system resources from an operating system.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0179b/ar01s02s07.html
brk
Breakpoint instruction. A BRK instruction generates a Breakpoint Instruction exception. The PE records the exception in ESR_ELx, using the EC value 0x3c, and captures the value of the immediate argument in ESR_ELx.ISS.