Re:Intel fires warning shots at Microsoft, says x86 emulatio...
by kccqzy on Saturday June 10, 2017 @06:22PM
(#14529519)
Regarding 5, no, it's five bytes (b8 01 00 00 00) for movl $1,%eax. If you actually have a 64-bit immediate, just the immediate itself would be 8 bytes, and the actual instruction is 10 bytes.
[ Parent
| on HN ]
Re:Intel fires warning shots at Microsoft, says x86 emulatio...
by besselheim on Saturday June 10, 2017 @08:28PM
(#14529971)
MOV RAX, 1 is seven bytes: 48 C7 C0 01 00 00 00
Re:Intel fires warning shots at Microsoft, says x86 emulatio...
by pcwalton on Saturday June 10, 2017 @08:47PM
(#14530041)
The parent has a good point actually, because "mov eax,1" automatically zero-extends in 64-bit mode.
It's still one byte longer than the equivalent AArch64 instruction, though.
Re:Intel fires warning shots at Microsoft, says x86 emulatio...
by kccqzy on Saturday June 10, 2017 @11:18PM
(#14530431)
Fine. If you are really into getting the shortest instruction, try "xorl %eax,%eax" then "incl %eax" which is four bytes (31 c0 ff c0).
Re:Intel fires warning shots at Microsoft, says x86 emulatio...
by gsg on Sunday June 11, 2017 @12:35AM
(#14530655)
push $1/pop %eax (6a 01 58) is shorter, but perhaps not the best idea.