Alex Hoang
Alex Hoang

Reputation: 1

Converting machine code snippet to assembly

I'm working on an assignment that's asking me to convert some lines of machine code to assembly. Here's an example

0x0000000080001294 : EB01001F

According to some people online, this translates to CMP X0, X1 in assembly.

From what I understand, you're supposed to take the "EB01001F", convert it to binary, and use an opcode table to figure out the rest. When putting it into binary, here's what I get:

11101011000000010000000000011111

The problem is the opcode table in the textbook I have has nothing that matches up with any of this so I'm lost, can someone help me out?

Upvotes: 0

Views: 1023

Answers (1)

Jester
Jester

Reputation: 58762

We don't know what table your textbook has. Maybe it has the endianness reversed. Official arm documentation however uses your bit order. You can find the CMP (shifted register) instruction which looks like:

1110 1011 ss0m mmmm iiii iinn nnn1 1111 (structure from manual)
1110 1011 0000 0001 0000 0000 0001 1111 (your bits)

In particular you can see i=0 (the shift amount), m=1 (second operand) and n=0 (first operand) hence it is really CMP X0, X1 as expected.

Upvotes: 2

Related Questions