Ronny
Ronny

Reputation: 1

Setting a hardware breakpoint in arm64

Hi I'm looking for some references so i can manually set hardware breakpoint on arm64 when running in arm32 or thumb mode, unfortunately not much resources or examples are available on it. I want to break on a certain address but idk in which register i have to copy the address so processor can break on it

Upvotes: 0

Views: 787

Answers (1)

Siguza
Siguza

Reputation: 23820

The ARMv8 Reference Manual has a table (Table D1-29 in version G.b of the manual) that maps AArch64 registers to their AArch32 counterparts. This includes:

  • DBGBCR<n>_EL1[31:0] -> DBGBCR<n>
  • DBGBVR<n>_EL1[31:0] -> DBGBVR<n>
  • DBGBVR<n>_EL1[63:32] -> DBGBXVR<n>

So whatever you'd write to the former register in AArch64, you instead write to the latter register in AArch32.
That is, assuming you're running the kernel in AArch32 mode. If the AArch32 thing you want to debug is in userland and is running under an AArch64 kernel, then you should be able to just use the debug registers as normal, like you would with an AArch64 process.

Upvotes: 1

Related Questions