tags:

views:

198

answers:

2

The NOP opcode for x86/x86_64 is 0x90, but which is the analog on the iPhone with the ARM instruction set?

+4  A: 

MOV r0, r0 is traditionally used in ARM code, which has the opcode 0xe1a00000; MOV r8, r8 is used in THUMB code (opcode 0x46c0)

moonshadow
Does this not have side effects on the architecture?
Stefan Kendall
@Stefan, I don't think so. Those are the machine instructions my assembler generates when I put a 'nop' instruction in the source file.
Carl Norum
Apparently Thumb2 has a NOP instruction. See page 5 of http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf
MArag
+3  A: 

ARMv7 has an actual NOP instruction, with the following encodings:

    0xbf00  2 byte thumb2 form
0xf3af8000  4 byte thumb2 form
0x*320f000  4 byte arm form

When targeting earlier versions of the architecture, assemblers translate NOP into the MOV instructions that moonshadow listed.

You shouldn't need to use the actual opcodes, as the development tools understand NOP.

Stephen Canon