Skip to content

Commit eb97134

Browse files
authored
PAC FAQ fix: Read HCR_EL2 instead of clobbering with SCTLR_EL1 (#2259)
The sample code for setting up PAC is missing the read register call for `HCR_EL2`. This leads to clobbering HCR_EL2 with whatever the bits in `SCTLR_EL1` were.
1 parent db6d135 commit eb97134

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/FAQ.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ Taken from [#1789](https://github.com/unicorn-engine/unicorn/issues/1789).
231231
reg.crm = 0b0001;
232232
reg.op2 = 0b000;
233233

234+
err = uc_reg_read(uc, UC_ARM64_REG_CP_REG, &reg);
235+
assert(err == UC_ERR_OK);
236+
234237
// HCR.API
235238
reg.val |= (1ULL<<41);
236239

0 commit comments

Comments
 (0)