Re:Sol – a sunny little virtual machine (2012)
by saagarjha on Saturday June 06, 2020 @12:26PM
(#23440284)
Does your ISA let you double the program counter? How about XOR it?
[ Parent
| on HN ]
Re:Sol – a sunny little virtual machine (2012)
by Reelin on Saturday June 06, 2020 @07:49PM
(#23443391)
This got me curious so I looked it up. My understanding is yes on ARM32, not sure on ARM64, and yes with only minor indirection on x86 and x86_64. For example (x86, untested):
call 0
pop eax
shl eax 1
jmp eax
Note that using call 0 in this way doesn't trash the return address predictor because it is special cased (since at least Pentium Pro as far as I could find).