aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/arch
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2021-02-23 00:39:03 +0100
committerjohannst <johannes.stoelp@gmail.com>2021-02-23 00:39:03 +0100
commitd44d6c1efdf8bf0d43b98e512503d66521b2be00 (patch)
tree6b4f24e497d7cd2d953042760aa285a4c7016c77 /src/arch
parent198c84bbc80ef84ed6a95c1638888765ac023c88 (diff)
downloadnotes-d44d6c1efdf8bf0d43b98e512503d66521b2be00.tar.gz
notes-d44d6c1efdf8bf0d43b98e512503d66521b2be00.zip
arm64: add control flow and system register access instructions
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/arm64.md25
1 files changed, 25 insertions, 0 deletions
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 <offset> // relative forward/back branch
+br <Xn> // absolute branch to address in register Xn
+
+// branch & link, store return address in X30 (LR)
+bl <offset> // relative forward/back branch
+blr <Xn> // absolute branch to address in register Xn
+
+ret {Xn} // return to address in X30, or Xn if supplied
+```
+
## Addressing
### Offset
```armasm