From d44d6c1efdf8bf0d43b98e512503d66521b2be00 Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 23 Feb 2021 00:39:03 +0100 Subject: arm64: add control flow and system register access instructions --- src/arch/arm64.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/arch/arm64.md b/src/arch/arm64.md index 1bf76b4..68c4bfa 100644 --- a/src/arch/arm64.md +++ b/src/arch/arm64.md @@ -40,6 +40,31 @@ elr_el3 exception link register EL3 spsr_el3 saved process status register EL3 ``` +## Instructions cheatsheet + +### Accessing system registers +Reading from system registers: +```armasm +mrs x0, vbar_el1 // move vbar_el1 into x0 +``` + +Writing to system registers: +```armasm +msr vbar_el1, x0 // move x0 into vbar_el1 +``` + +### Control Flow +```armasm +b // relative forward/back branch +br // absolute branch to address in register Xn + +// branch & link, store return address in X30 (LR) +bl // relative forward/back branch +blr // absolute branch to address in register Xn + +ret {Xn} // return to address in X30, or Xn if supplied +``` + ## Addressing ### Offset ```armasm -- cgit v1.2.3