Dne 01. 03. 25 v 23:48 Rudolf Marek napsal(a):
I don't know how slow is to do the jump back via far jump.
I did some micro benchmark on Raptorlake platform using other operating system
I'm very familiar with.
I added following sequence to the SYSCALL64 entrypoint:
.balign 16
syscallentry64:
.byte 0x48
ljmp *jmpaddr(%rip)
continuehere:
swapgs
<...>
jmpaddr:
.quad continuehere
.word KERN_OTHER_CS << 3
And well, it is 1.5x slower. Unmodified syscall benchmark took on avg 261
cycles / 104 ns and the one with the indirect jump with %cs change took
386 cycles/ 154 ns.
This whole thing is quite literally a trap next to a trap, because GAS wasn't
adding REX.W prefix and somehow complained about ljmpq.
Thanks,
Rudolf