unicorn-engine / unicorn

Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, S390x, TriCore, X86)
http://www.unicorn-engine.org
GNU General Public License v2.0
7.34k stars 1.31k forks source link

Enable ARM64e PAC instructions and atomic instructions #1818

Closed peternguyen93 closed 1 year ago

peternguyen93 commented 1 year ago

Hello team, I re-created my patch to enable ARM64e support for unicorn in dev branch.

nneonneo commented 1 year ago

I think you can enable PAC via

  1. setting the right CPU model via uc_set_cpu_model
  2. setting the SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB bits in SCTLR_EL1
  3. setting APA=1, GPA=1 in ID_AA64ISAR1_EL1

These registers can be set via read-write-modify to UC_ARM64_REG_CP_REG with the appropriate configuration. All of these things can be done from normal code without hacking QEMU or Unicorn itself.

wtdcode commented 1 year ago

Link to #1789, I should really doc it...

wtdcode commented 1 year ago

Documented: https://github.com/unicorn-engine/unicorn/wiki/FAQ#does-unicorn-support-arm-pac-pointer-authentication