1

Is it a safe assumption, say for x86, that an instruction either does not access memory, or only reads from memory, or writes to memory?

I could not find any instruction but I am not sure if this really is the case.

What about ARM and MIPS?

  • 7
    movsb has been in the x86 family since the venerable 8086 and reads and writes memory. – Guntram Blohm Mar 15 '16 at 14:19
  • I see. Thanks for the counter example. This means I have to deal with the case. – langlauf.io Mar 15 '16 at 14:24
  • 3
    You'll also have to deal with all instructions where the combined source/destination operand can be a memory location, starting with the lowly inc [mem] and add [mem], whatever. – DarthGizka Mar 15 '16 at 18:12
  • 1
    On ARM there only instructions that touch memory is "read from memory to a register" and "write a register to memory, so no. – Vitaly Osipov Mar 16 '16 at 0:38
  • 1
    In addition to movsb, there's also bts. – Jason Geffner Mar 17 '16 at 15:41
2

Your question has been answered in comments for x86 - movsb both reads and writes to memory.

On ARM the only instructions that touch memory is "read from memory to a register" and "write a register to memory", so no there aren't. Same with MIPS.

IIRC all (or almost all?) RISC processors are this "load and store" architecture.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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