1

I'm reverse engineering an ARM64 binary and I came across the following instruction

48 05 48 4A    eor w8, w10, w8, lsr #1

I looked up the definition of ARM64's eor instruction here: https://developer.arm.com/documentation/dui0473/m/arm-and-thumb-instructions/eor

Unfortunately, the information in that documentation doesn't directly address the optional lsr #1 part of the instruction.

I understand this instruction would generally perform a Bitwise Exclusive OR between registers w10 and w8, storing the result in register w8. What I'm unsure about is the Logical Shift Right portion. Does this shift occur on the result of the EOR, or does it first shift one of the registers and then perform the EOR?

Also, if anyone can recommend a good tool for testing this I would be appreciative.

Thank you.

2 Answers 2

5

It's the 2nd operand (i.e. w8 in your example) that is shifted before the relevant calculation is done.

You can see the explanation in the same document you linked to in the section Syntax of Operand2 as a register with optional shift. This is pulled out separately in the documentation as this Operand2 feature applies to multiple different instructions, not just EOR.

1
  • Thank you. I was unable to initially find this information since it was not directly included with the EOR documentation. This explanation confirms my previous conclusion regarding how the EOR with shift works.
    – h0r53
    Jul 20, 2022 at 15:21
1

I found a simple online ARM emulator here: https://wunkolo.github.io/OakSim/

I crafted an example and it appears that the instruction works by first performing the Logical Shift Right on register w8, then the result of that operation is EOR'd with register w10, and finally the result is stored in register w8.

So the sequence of events is:

  1. Shift register
  2. EOR
  3. Store result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.