]> xenbits.xensource.com Git - xen.git/commit
x86/altcall: Introduce new simpler scheme
authorAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 19 Apr 2025 22:05:52 +0000 (23:05 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 23 Apr 2025 18:37:57 +0000 (19:37 +0100)
commitac02ee9c82d115a824629edb10c14f260108ef56
tree94491751204210ee8ae9670feda0d403a83034f2
parent9815ce18f29ffb7009480c4f60cb5b2d2056cf72
x86/altcall: Introduce new simpler scheme

Encoding altcalls as regular alternatives leads to an unreasonable amount of
complexity in _apply_alternatives().

Introduce apply_alt_calls(), and an .alt_call_sites section which simply
tracks the source address (relative, to save on space).  That's literally all
that is needed in order to devirtualise the function pointers.

apply_alt_calls() is mostly as per _apply_alternatives(), except the size is
known to be 6 bytes.  Drop the logic for JMP *RIPREL, as there's no support
for tailcall optimisations, nor a feasbile plan on how to introduce support.
Pad with a redundant prefix to avoid needing a separate NOP on the end.

Wire it up in nmi_apply_alternatives(), although the section is empty at this
juncture so nothing happens in practice.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/alternative.c
xen/arch/x86/include/asm/alternative-call.h
xen/arch/x86/xen.lds.S