News for hackers. Stuff that matters.
Re:ARM and Lock-Free Programming by Dylan16807 on Tuesday December 01, 2020 @04:25AM (#25263762)
The biggest thing for quickly finding instruction boundaries is probably not having prefixes, which is pretty straightforward.
Re:ARM and Lock-Free Programming by cesarb on Tuesday December 01, 2020 @07:27AM (#25264574)
Not having suffixes helps too. AFAIK, on x86 to find the length of an instruction, first you have to decode the instruction itself (the decoding can vary depending on the prefixes) to know if it is followed by a modRM byte, then decode the modRM byte to know whether it is followed by an immediate or not and how big that immediate is, and only then can you know where the next instruction is. The modRM byte (and the SIB byte) can be thought of as a "suffix" of sorts to the instruction.

Contrast for instance with RISC-V, where the first byte of every instruction has everything necessary to know the instruction length (and you only need 2 bits of that byte unless your core supports instructions longer than 4 bytes).