From c6549554e667f28e670474bcf4915521599b67b8 Mon Sep 17 00:00:00 2001 From: Daniel Roethlisberger Date: Tue, 11 Nov 2025 23:12:40 +0100 Subject: [PATCH] PAC FAQ fix: Read HCR_EL2 instead of clobbering with SCTLR_EL1 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. --- docs/FAQ.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/FAQ.md b/docs/FAQ.md index ccac896392..e581f5cca2 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -231,6 +231,9 @@ Taken from [#1789](https://github.com/unicorn-engine/unicorn/issues/1789). reg.crm = 0b0001; reg.op2 = 0b000; + err = uc_reg_read(uc, UC_ARM64_REG_CP_REG, ®); + assert(err == UC_ERR_OK); + // HCR.API reg.val |= (1ULL<<41);