Skip to content

aarch64memo

tyfkda edited this page Aug 6, 2023 · 14 revisions

aarch64 memo

Mnemonic

  • mov dst, src : dst <- src
  • ldr dst, src : dst <- src
  • str src, dst : src -> dst
  • add dst, opr1, opr2 : dst <- opr1 + opr2

Registers

  • X0~X30
  • X31 = SP or XZR(Zero register)
  • X30 = Procedure link register (Return address)
  • X29 = Frame Pointer

Calling conventions

Calling convention # ARM(A64) - Wikipedia

Regs. Purpose
X0~X7 Function parameters
X9~X15 Local variables: (Caller save)
X19~X29 Callee save
X29 Frame pointer (FP)
X30 Procedure link register (LR)
X31 Stack pointer (SP)

構造体引数

  • 構造体が格納されているアドレスをレジスタで渡してるっぽい

構造体戻り値

  • x8に格納先アドレスを渡してるっぽい

Appple M1

Variaic function parameters: 常にスタック経由で渡される。

Addressing Architectural Differences in Your macOS Code | Apple Developer Documentation

Don’t Redeclare a Function to Have Variable Parameters

... On arm64, the compiler always places variadic parameters on the stack, regardless of whether registers are available.

//

Clone this wiki locally