Jump-table walks see overwritten indices and every write of a table base

jump_offsets and half_count followed mov w9,w0 as a copy into the index but
kept w9 as the index too, so a check of w9 before the copy counted as bounding
the new value. A copy now replaces the index, as jump_adr_offsets already did.

The table-base writer chains and jump_adr_offsets' search for the adr compared
written names with xN, so a write of wN went unseen, as did lr and fp, and a
compare of xN counted as a write. They now ask writes_reg, which sees either
width and those names and leaves compares out.

Absolum's main is the one change in the modules compared: four halfword tables
based in x30 go from 65,536 landing pads to their real sizes (445, 373, 301,
257, each checked against its table), and the patch area from 3.7 MB to 570 KB.

Checked: test_jump_copies.py (the new cases fail on the previous rewriter).
Old and new rewriters give identical output on 50 other mains; the check was
capped, smallest mains first, so 27 of the 80 game folders and the largest
mains were not reached. Two mains fail alike under both. No regress.py run: the
reach is narrow and Absolum's tables were checked directly, and Absolum has no
smoke route.
This commit is contained in:
seedds committed 2026-11-02 21:21:41 +08:00
1 parent 22458aa14d
commit e5620b1a05
5 files changed
+69 -19

No files matched your search

+1
View File
@@ -59,6 +59,7 @@ The effects (`.xnb`) are XNA's D3D9 effects (MOJOSHADER is linked in and parses
General host changes first needed here; each applies to every game:
- **Halfword tables based in x30 sized from their tables**, four in `main` (patch area 3.7 MB to 570 KB): [Overwritten jump-table indices and bases taken as unchanged](../../../docs/reference/rewriter.md#overwritten-jump-table-indices-and-bases-taken-as-unchanged).
- **Data blocks at the start of the text left alone** (`nso_code.py`, `DATA_BLOCKS`): [Data blocks at the start of the text](../../../docs/reference/rewriter.md#data-blocks-at-the-start-of-the-text).
- **`getenv` answered from the profile** (`game_env`, `hle_os.c`) and **the 32 MB alignment cut for large regions on SDK 18**, later taken by Paper Mario: The Thousand-Year Door's and Celeste's SDK 15.3.2 build: [.NET NativeAOT malloc and the GC region range](../../../docs/reference/memory.md#net-nativeaot-malloc-and-the-gc-region-range), [1 GB alignment of regions of 1 GB and more](../../../docs/reference/memory.md#1-gb-alignment-of-regions-of-1-gb-and-more).
- **`vi::CreateLayer` with a size**, **AudioIn absent**, **online SDK NROs refused** (`ONLINE_SDKS`), **`nso_syms.py host_hooks` reading `dm/gfx`**, **NVIDIA's GPU drivers never loaded** (`GPU_DRIVERS`): [`vi::CreateLayer` with the layer's size](../../../docs/reference/services.md#vicreatelayer-with-the-layers-size), [No audio input devices](../../../docs/reference/audio.md#no-audio-input-devices), [Online SDKs in NROs are never loaded](../../../docs/reference/services.md#online-sdks-in-nros-are-never-loaded), [Listing a game's unhooked imports before they are met](../../../docs/reference/services.md#listing-a-games-unhooked-imports-before-they-are-met), [GPU driver modules that are never loaded](../../../docs/reference/services.md#gpu-driver-modules-that-are-never-loaded).
+13 -13
View File
@@ -207,6 +207,9 @@ def written_w(p):
Capstone lists a compare's first operand as written too, so a caller that only wants real writes leaves compares out"""
names = ({'lr': 'x30', 'fp': 'x29'}.get(n, n) for n in map(p.reg_name, p.regs_access()[1]))
return {f'w{num(n)}' for n in names if num(n) is not None}
def writes_reg(p, reg):
"""Whether p changes the general-purpose register reg (xN or wN): a write of wN clears the upper half of xN too, and a compare only sets the flags"""
return p.mnemonic not in ('cmp', 'cmn', 'tst') and 'w' + reg[1:] in written_w(p)
def has18(ins): return re.search(r'\b[xw]18\b', ins.op_str) is not None
def regs_in(ins):
s = {int(n) for n in re.findall(r'\b[xw](\d+)\b', ins.op_str)}
@@ -697,12 +700,12 @@ def jump_offsets(insl, j, copy_first=False, far_base=False, forward_base=False):
# GLSLC subsdk0+0x2f403c checks a masked copy instead: and w16,w18,#0x3f; cmp w16,#0xe; b.hi; ...; and x18,x18,#0x3f; ldrsw x18,[x15,x18,lsl #2]
idx = {'w' + re.fullmatch(rf'{t}, \[{rb}, x(\d+), lsl #2\]', ld.op_str).group(1)} # pyright: ignore[reportOptionalMemberAccess] # ld was chosen by this match
masked = None # (source, mask, position) when the index is "source & mask"
k0 = ctx.index(ld); cmp = None
k0 = ctx.index(ld); cmp = None; copies = set()
def wname(r): return 'w' + r[1:]
for i in range(k0 - 1, -1, -1): # walk back from the load: follow register copies into the index, stop at the bounds check
p = ctx[i]
m = re.fullmatch(r'(w\d+), (w\d+)', p.op_str) if p.mnemonic == 'mov' else None
if m and m.group(1) in idx: idx.add(m.group(2)); continue
if m and m.group(1) in idx: idx.remove(m.group(1)); idx.add(m.group(2)); copies.add(m.group(1)); continue # a copy replaces the index: a check of its old value bounds nothing
m = re.fullmatch(r'([wx]\d+), ([wx]\d+), #(0x[0-9a-f]+|\d+)', p.op_str) if p.mnemonic == 'and' else None
if m and wname(m.group(1)) in idx and masked is None: masked = (wname(m.group(2)), int(m.group(3), 0), i); continue
# A 64-bit check of the index bounds it as well (OCTOPATH TRAVELER 1.0.5 main+0x1676f30: cmp x22,#0x10; ...; b.hi; adrp x18 + add x18; mov x0,x18; ldrsw x18,[x0,x22,lsl #2];
@@ -719,13 +722,12 @@ def jump_offsets(insl, j, copy_first=False, far_base=False, forward_base=False):
cmp = p
break
if cmp: break
if not cmp and copy_first: cmp = check_before_copy(insl, ctx, ld, idx)
if not cmp and copy_first: cmp = check_before_copy(insl, ctx, ld, idx | copies)
if not cmp: return None
n = int(cmp.op_str.split('#')[1], 0) + 1
k = insl.index(ld); lo = page = None
for p in reversed(insl[max(0, k - 256):k]): # the writer chain of the table base
_, w = p.regs_access()
if not any(p.reg_name(r) == rb for r in w): continue
if not writes_reg(p, rb): continue
if lo is None and p.mnemonic == 'add' and re.fullmatch(rf'{rb}, {rb}, #(0x[0-9a-f]+|\d+)', p.op_str): lo = int(p.op_str.split('#')[1], 0); continue
if lo is not None and p.mnemonic == 'adrp' and p.op_str.startswith(rb + ','): page = p.operands[1].imm
break
@@ -829,8 +831,7 @@ def table_base(insl, k, rb, far=False):
lo = None
for p in reversed(insl[0 if far else max(0, k - 256):k]):
if far and p.mnemonic in ('bl', 'blr') and num(rb) <= 18: return None # pyright: ignore[reportOptionalOperand] # a table base register, always xN
_, w = p.regs_access()
if not any(p.reg_name(r) == rb for r in w): continue
if not writes_reg(p, rb): continue
if lo is None and p.mnemonic == 'add' and re.fullmatch(rf'{rb}, {rb}, #(0x[0-9a-f]+|\d+)', p.op_str): lo = int(p.op_str.split('#')[1], 0); continue
if lo is not None and p.mnemonic == 'adrp' and p.op_str.startswith(rb + ','): return p.operands[1].imm + lo
return None
@@ -877,9 +878,8 @@ def jump_masked_not(insl, j):
head, end = test.address, insl[j].address
if head <= branch.operands[0].imm <= end: return None
def writes(p, reg):
if p.mnemonic in ('cmp', 'cmn', 'tst'): return False
if p.mnemonic in ('bl', 'blr') and int(reg[1:]) <= 18: return True
return 'w' + reg[1:] in written_w(p)
return writes_reg(p, reg)
if any(writes(p, idx) for p in ctx[km + 1:kl]) or any(writes(p, ent) for p in ctx[kl + 1:ka]) or \
any(writes(p, base) for p in ctx[kl + 1:ka + 1]) or any(writes(p, 'x18') for p in ctx[ka + 1:-1]): return None
if any(p.mnemonic in ('b', 'bl', 'br', 'blr', 'ret', 'cbz', 'cbnz', 'tbz', 'tbnz') or p.mnemonic.startswith('b.') for p in ctx[km + 1:-1]): return None
@@ -902,7 +902,7 @@ def jump_adr_offsets(insl, j):
ka = ctx.index(add); ops = add.op_str.split(', ')[1:]
for e, a in (ops, ops[::-1]): # e = the loaded entry, a = the adr base
ld = next((p for p in reversed(ctx[:ka]) if p.mnemonic == 'ldrsw' and re.fullmatch(rf'{e}, \[x\d+, x\d+, lsl #2\]', p.op_str)), None)
wa = next((p for p in reversed(ctx[:ka]) if any(p.reg_name(r) == a for r in p.regs_access()[1])), None) # the nearest writer of a
wa = next((p for p in reversed(ctx[:ka]) if writes_reg(p, a)), None) # the nearest writer of a
if not ld or not wa or wa.mnemonic != 'adr': continue
tb_reg, ix = re.fullmatch(rf'{e}, \[(x\d+), x(\d+), lsl #2\]', ld.op_str).groups()
idx, cmp = {'w' + ix}, None # the index and the registers copied into it (main+0x596d30: cmp w15,#8; b.hi; mov w16,w15; ...; ldrsw x0,[x17,x16,lsl #2])
@@ -929,7 +929,7 @@ def table_cands(insl, rb):
cands = set()
for k, p in enumerate(insl):
if p.mnemonic != 'adrp' or not p.op_str.startswith(rb + ','): continue
q = next((x for x in insl[k + 1:k + 9] if any(x.reg_name(r) == rb for r in x.regs_access()[1])), None)
q = next((x for x in insl[k + 1:k + 9] if writes_reg(x, rb)), None)
m = re.fullmatch(rf'{rb}, {rb}, #(0x[0-9a-f]+|\d+)', q.op_str) if q is not None and q.mnemonic == 'add' else None
if m: cands.add(p.operands[1].imm + int(m.group(1), 0))
return sorted(cands)
@@ -1092,7 +1092,7 @@ def jump_bytes_far(insl, j):
for k in range(len(ctx) - 1, -1, -1):
p = ctx[k]
if p.mnemonic == 'add' and p.op_str.startswith('x18, x18,') and 'lsl #2' in p.op_str: break
if any(p.reg_name(r) == 'x18' for r in p.regs_access()[1]): return None
if writes_reg(p, 'x18'): return None
else: return None
rn = p.reg_name(p.operands[2].reg); idx = {'lr': 30, 'fp': 29}.get(rn, num(rn))
base = next((q.operands[1].imm for q in reversed(ctx[:k]) if q.mnemonic == 'adr' and q.op_str.startswith('x18,')), None)
@@ -1111,7 +1111,7 @@ def half_count(insl, ld, base):
idx, cmp = {'w' + m.group(2)}, None
for p in reversed(insl[max(0, k - 32):k]): # walk back from the load to the bounds check
mm = re.fullmatch(r'(w\d+), (w\d+)', p.op_str) if p.mnemonic == 'mov' else None
if mm and mm.group(1) in idx: idx.add(mm.group(2)); continue
if mm and mm.group(1) in idx: idx.remove(mm.group(1)); idx.add(mm.group(2)); continue # a copy replaces the index: a check of its old value bounds nothing
mm = re.fullmatch(r'(w\d+), #(0x[0-9a-f]+|\d+)', p.op_str) if p.mnemonic == 'cmp' else None
if mm and mm.group(1) in idx: cmp = p; break
if written_w(p) & idx: return None # the index changes after the check
+45 -6
View File
@@ -21,7 +21,7 @@ from nso_asm import ADRP, ADDI, ADDR, B, BEQ, BLR, BR, NOP
tree = ast.parse((TOOLS / 'patch_nso.py').read_text())
IMG = bytearray(0x5000); tabjumps = {}; jumps = {} # the globals the recognizers read: the module image and the jump tables resolved so far in the function
scope = {'re': re, 'struct': struct, 'ARM64_OP_IMM': ARM64_OP_IMM, 'IMG': IMG, 'tabjumps': tabjumps, 'jumps': jumps}
exec(compile(ast.Module(body=[n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name in ('num', 'written_w', 'half_count', 'copied_base', 'table_base', 'table_cands', 'forward_table_base', 'check_before_copy', 'jump_offsets', 'jump_adr_offsets', 'jump_zero_extended', 'jump_masked_pred', 'jump_masked_not')], type_ignores=[]), str(TOOLS / 'patch_nso.py'), 'exec'), scope)
exec(compile(ast.Module(body=[n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name in ('num', 'written_w', 'writes_reg', 'half_count', 'copied_base', 'table_base', 'table_cands', 'forward_table_base', 'check_before_copy', 'jump_offsets', 'jump_adr_offsets', 'jump_zero_extended', 'jump_masked_pred', 'jump_masked_not')], type_ignores=[]), str(TOOLS / 'patch_nso.py'), 'exec'), scope)
def mov(dst, src, wide=True): return (0xaa0003e0 if wide else 0x2a0003e0) | src << 16 | dst
@@ -52,6 +52,19 @@ class CopiedBase(unittest.TestCase):
self.assertIsNone(self.follow(self.base() + [mov(30, 7), call, mov(7, 30)]))
self.assertEqual(self.follow(self.base(19) + [call, mov(7, 19)]), 0x440c)
def base_at_load(self, words, reg='x7'):
md = Cs(CS_ARCH_ARM64, CS_MODE_ARM); md.detail = True
ins = list(md.disasm(struct.pack('<' + 'I' * len(words), *words), 0))
self.assertEqual(len(ins), len(words))
return scope['table_base'](ins, len(ins), reg)
def test_table_base_sees_every_write_of_the_register(self):
self.assertEqual(self.base_at_load(self.base()), 0x440c)
self.assertIsNone(self.base_at_load(self.base() + [mov(7, 0, False)])) # mov w7,w0 replaces the base too
self.assertEqual(self.base_at_load(self.base(30), 'x30'), 0x440c) # capstone names the writes lr
self.assertEqual(self.base_at_load(self.base() + [0x710004ff]), 0x440c) # cmp w7,#1 only sets the flags
self.assertEqual(self.base_at_load(self.base() + [0xf10004ff]), 0x440c) # cmp x7,#1
def test_aliases_and_unrelated_writes(self):
self.assertEqual(self.follow(self.base(29) + [mov(7, 29)]), 0x440c)
self.assertEqual(self.follow(self.base(30), 'lr'), 0x440c)
@@ -78,17 +91,20 @@ class AdrOffsetBounds(unittest.TestCase):
TABLE = 0x4040
TARGETS = [0, 8, 36, 40, 44]
def run_site(self, wide=True, index=9, clobber=NOP, loaded=9):
def run_site(self, wide=True, index=9, clobber=NOP, loaded=9, after_adr=NOP):
# adrp/add x15; cmp x9,#4; b.hi; adr x18,.; ldrsw x0,[x15,x9,lsl #2]; add x18,x18,x0; br x18.
# The compare and ADR bases are independent, as in DRAGON QUEST I & II's copy dispatch.
words = [ADRP(15, 0, self.TABLE), ADDI(15, 15, self.TABLE & 0xfff),
(0xf100001f if wide else 0x7100001f) | 4 << 10 | index << 5, bhi(12, 44), clobber,
0x10000012, 0xb8a07800 | loaded << 16 | 15 << 5, ADDR(18, 18, 0), BR(18), RET, RET, RET]
0x10000012, after_adr, 0xb8a07800 | loaded << 16 | 15 << 5, ADDR(18, 18, 0), BR(18), RET, RET, RET]
for i, target in enumerate(self.TARGETS): struct.pack_into('<i', IMG, self.TABLE + 4 * i, target - 20)
md = Cs(CS_ARCH_ARM64, CS_MODE_ARM); md.detail = True
ins = list(md.disasm(struct.pack('<' + 'I' * len(words), *words), 0))
self.assertEqual(len(ins), len(words))
return scope['jump_adr_offsets'](ins, 8)
return scope['jump_adr_offsets'](ins, 9)
def test_a_32_bit_write_after_the_adr_replaces_its_value(self):
self.assertIsNone(self.run_site(after_adr=mov(18, 0, False)))
def test_64_bit_comparison_bounds_the_table(self):
self.assertEqual(self.run_site(), self.TARGETS)
@@ -121,10 +137,11 @@ class HalfCount(unittest.TestCase):
"""The pads a halfword table needs: the check's bound, or None when the index may have changed after it."""
TABLE = 0x4100
def run_site(self, index=9, clobber=NOP):
def run_site(self, index=9, clobber=NOP, loaded=None):
loaded = index if loaded is None else loaded
# adrp/add x15; cmp w9,#4; b.hi; <clobber>; ldrh w0,[x15,x9,lsl #1]; adr x18,.; add x18,x18,x0,lsl #2; br x18
words = [ADRP(15, 0, self.TABLE), ADDI(15, 15, self.TABLE & 0xfff), 0x7100001f | 4 << 10 | index << 5, bhi(12, 36), clobber,
0x78607800 | index << 16 | 15 << 5, 0x10000012, 0x8b000a52, BR(18), RET]
0x78607800 | loaded << 16 | 15 << 5, 0x10000012, 0x8b000a52, BR(18), RET]
struct.pack_into('<5H', IMG, self.TABLE, 0, 1, 2, 3, 4)
md = Cs(CS_ARCH_ARM64, CS_MODE_ARM); md.detail = True
ins = list(md.disasm(struct.pack('<' + 'I' * len(words), *words), 0))
@@ -143,6 +160,28 @@ class HalfCount(unittest.TestCase):
self.assertEqual(self.run_site(index=reg), 5)
self.assertIsNone(self.run_site(index=reg, clobber=mov(reg, 0)))
def test_a_copy_replaces_the_index(self):
self.assertIsNone(self.run_site(clobber=mov(9, 0, False))) # cmp w9; mov w9,w0: the check says nothing of w0
self.assertEqual(self.run_site(index=0, loaded=9, clobber=mov(9, 0, False)), 5) # cmp w0; mov w9,w0
class CopyAfterCheck(unittest.TestCase):
TABLE = 0x4040
TARGETS = [32 + i * 4 for i in range(5)]
def run_site(self, checked):
# adrp/add x4; cmp wN,#4; b.hi; mov w18,w21; ldrsw x18,[x4,x18,lsl #2]; add x18,x18,x4; br x18 (Link's Awakening's movie module checks w21)
words = [ADRP(4, 0, self.TABLE), ADDI(4, 4, self.TABLE & 0xfff), 0x7100001f | 4 << 10 | checked << 5, bhi(12, 32),
mov(18, 21, False), 0xb8a07800 | 18 << 16 | 4 << 5 | 18, ADDR(18, 18, 4), BR(18)] + [RET] * 5
for i, target in enumerate(self.TARGETS): struct.pack_into('<i', IMG, self.TABLE + 4 * i, target - self.TABLE)
md = Cs(CS_ARCH_ARM64, CS_MODE_ARM); md.detail = True
ins = list(md.disasm(struct.pack('<' + 'I' * len(words), *words), 0))
return scope['jump_offsets'](ins, 7)
def test_the_check_must_be_of_the_source(self):
self.assertEqual(self.run_site(21), self.TARGETS)
self.assertIsNone(self.run_site(18))
class ForwardBase(unittest.TestCase):
"""Entry jumps over the dispatch to its sole base initialization, then branches backward."""
+1
View File
@@ -46,6 +46,7 @@ One line per symptom in the [subsystem references](../reference/): what you see
- `jump table <addr>` assertion, entries relative to an `adr`. → [Offset tables relative to an adr](../reference/rewriter.md#offset-tables-relative-to-an-adr)
- `AssertionError: jump table 30ee50c` while rewriting an ADR-relative dispatch with `cmp x9,#4`. → [ADR-relative jump tables with 64-bit bounds](../reference/rewriter.md#adr-relative-jump-tables-with-64-bit-bounds)
- `AssertionError: jump table 3ce6c` while rewriting `main`, on an ADR-relative dispatch that the existing form describes: `ldrb w0, [x18, #5]; cmp w0, #5; b.hi; ldr s0, [sp, #8]; ldr s1, [x18, #0xc]; adr x18, #L; ldrsw x1, [x17, x0, lsl #2]; add x18, x18, x1; br x18`. → [Vector registers read as writes of the jump-table index](../reference/rewriter.md#vector-registers-read-as-writes-of-the-jump-table-index)
- no failure seen on a game. The rewriter could read a jump table with the wrong size or base, so a case's target or landing pad would be missing or wrong. In the other direction, a halfword table whose base is in x30 got all 65,536 landing pads (`J` rows with 65536 in `main.sites.tsv`), which only makes the patch area larger. → [Overwritten jump-table indices and bases taken as unchanged](../reference/rewriter.md#overwritten-jump-table-indices-and-bases-taken-as-unchanged)
- `jump table <addr>` assertion on a byte table indexed by x30 (`adr x18, #L; ldrb w30, [x14, x12]; add x18, x18, x30, lsl #2; br x18`). → [Byte tables indexed by x30 (capstone register names)](../reference/rewriter.md#byte-tables-indexed-by-x30-capstone-register-names)
- `jump table <addr>` assertion on a byte table whose `add` is far from the `br` (`adr x18,#L; ldrb w0,[x17,x15]; add x18,x18,x0,lsl #2`, then 17 register moves before `br x18`). → [Byte tables whose add is far from the br](../reference/rewriter.md#byte-tables-whose-add-is-far-from-the-br)
- `jump table <addr>` assertion in `patch_nso.py`, in a Unity / IL2CPP `main`, at a `blr x18`. → [Indirect calls through x18](../reference/rewriter.md#indirect-calls-through-x18)
+9
View File
@@ -152,6 +152,15 @@ To enroll a cut for any game's own module:
- **Found on:** Tomodachi Life: Living the Dream (`010051F0207B2000`) 1.0.0, `main+0x3ce6c` (six targets, table at `main+0x2a5967c`), by the pull request's author: with the fix the game rewrites, packs as a Mac app from a provisional profile and boots to its first screen. The other forms were found by reading the code and shown on synthetic sites.
- **Check:** `dm/tools/tests/test_jump_copies.py` puts vector loads and x29 / x30 writes between the check and the load in each form, including `half_count`.
### Overwritten jump-table indices and bases taken as unchanged
- **Symptom:** no failure seen on a game. The rewriter could read a jump table with the wrong size or base, so a case's target or landing pad would be missing or wrong. In the other direction, a halfword table whose base is in x30 got all 65,536 landing pads (`J` rows with 65536 in `main.sites.tsv`), which only makes the patch area larger.
- **Cause:** `jump_offsets` and `half_count` followed `mov w9,w0` as a copy into the index but kept `w9` as the index too, so `cmp w9,#4` before the copy counted as its check. The table-base writer chains and `jump_adr_offsets`' search for the `adr` compared written names with `xN`, so a write of `wN`, which replaces the register as well, went unseen, as did `lr` and `fp`. A compare of `xN` counted as a write there.
- **Fix:** a copy replaces the index, as `jump_adr_offsets` already did. Those searches ask `writes_reg`, which sees either width and the `lr` / `fp` names and leaves compares out.
- **Found on:** reading the code while fixing [Vector registers read as writes of the jump-table index](#vector-registers-read-as-writes-of-the-jump-table-index). Of the 51 `main`s that rewrote in a comparison of old and new, only [Absolum](../../dm/games/0100A83022A22000/README.md)'s changed: its four tables at `main+0x1ed2dc`, `+0x1ed4fc`, `+0x1ed71c` and `+0x1ed8cc`, based in x30, went from 65,536 pads to 445, 373, 301 and 257, each its table's largest entry + 1, and the patch area from 3.7 MB to 570 KB.
- **Check:** `dm/tools/tests/test_jump_copies.py` `CopyAfterCheck`, `HalfCount`, `test_table_base_sees_every_write_of_the_register` and `test_a_32_bit_write_after_the_adr_replaces_its_value`.
- **Open:** `jump_offsets`' walk from the load back to the check still refuses no other write of the index, as `jump_adr_offsets` and `half_count` do: `add w18,w18,#1` between the check and the load is not noticed.
### Byte tables indexed by x30 (capstone register names)
- **Symptom:** `jump table <addr>` assertion on a byte table indexed by x30 (`adr x18, #L; ldrb w30, [x14, x12]; add x18, x18, x30, lsl #2; br x18`).