binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

[AArch64] Apple-specific system register names should not be present for all platforms

Open bdash opened this issue 2 months ago • 0 comments

Version and Platform (required):

  • Binary Ninja Version: 5.3.8714-dev Ultimate, 4a6b6596
  • OS: macos
  • OS Version: 26.1.0
  • CPU Architecture: arm64

Bug Description: The aarch64 disassembler currently includes system register names derived from both the ARM ISA data set and from a set of Apple implementation-specific register names. There are two big problems with this:

  • Apple register names are not applicable to non-Apple CPUs. Non-Apple CPUs may use the same implementation-defined system register for entirely different purposes.
  • Apple register names may vary across different generations or models of Apple CPUs. Different CPUs may use the same implementation-defined system register for entirely different purposes.

Ideally the Apple-specific register names would be split out of the aarch64 disassembler and added only when the binary is known to be for an Apple platform.

There are a couple of challenges here:

  1. The Apple-specific register names need to be available for firmware that may not be using Mach-O files.
  2. The aarch64 architecture plug-in uses the system register names in a number of places:
    1. It generates an enum type from the system register names that is applied as the argument type of intrinsics that work with system registers.
    2. Lifting mrs / mrs to IL is handled differently for known system register names.
    3. System register names are looked up when generating the textual disassembly.
    4. System register names can be looked up via GetRegisterName.

bdash avatar Dec 04 '25 16:12 bdash