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?

6
  • 7
    movsb has been in the x86 family since the venerable 8086 and reads and writes memory. Mar 15, 2016 at 14:19
  • I see. Thanks for the counter example. This means I have to deal with the case. Mar 15, 2016 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, 2016 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. Mar 16, 2016 at 0:38
  • 1
    In addition to movsb, there's also bts. Mar 17, 2016 at 15:41

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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