Skip to contentSkip to conversation

docs/hypercall-abi: Add a footnote about SYSCALL

PATCH In review Andrew Cooper 2 participants 2 messages Mar 31

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs/hypercall-abi: Add a footnote about SYSCALL

Given that we explicitly support guests making hypercalls without the use of the hypercall page (for CFI and speculative safety reasons), note explicitly that %rcx/%r11 need preserving/clobbering around SYSCALL.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

I've avoided mentioning FRED seeing as Xen (now) maintains legacy behaviour.

---
 docs/guest-guide/x86/hypercall-abi.rst | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
docs/guest-guide/x86/hypercall-abi.rst +5 -1
index e52ed453bcab..ffcf9b1b6d84 100644
@@ -62,7 +62,7 @@ between virtualisation mode and hardware vendor.
      - INT 0x82
 
    * - 64bit PV
-     - SYSCALL
+     - SYSCALL [#syscall]_
 
    * - Intel HVM
      - VMCALL
@@ -138,6 +138,10 @@ means.
    kernel, hypercalls issues from such a mode will be interpreted with the
    32bit ABI.  Such a setup is not expected in production scenarios.
 
+.. [#syscall] The ``SYSCALL`` instruction modifies ``%rcx`` and ``%r11``.
+   These registers want spilling or marking as clobbered if invoking the
+   hypercall without the use of the hypercall page.
+
 .. [#iret] ``HYPERCALL_iret`` is special.  It is only implemented for PV
    guests and takes all its parameters on the stack.  This stub should be
    ``jmp``'d to, rather than ``call``'d.  HVM guests have this stub
Signature · 1 line
2.34.1
#1 lore raw

docs/guest-guide/x86/hypercall-abi.rst means. · line 143

Quoted 7 lines · Andrew Cooper
docs/guest-guide/x86/hypercall-abi.rst +3 -0
@@ -138,6 +138,10 @@ means.
    kernel, hypercalls issues from such a mode will be interpreted with the
    32bit ABI.  Such a setup is not expected in production scenarios.
 
+.. [#syscall] The ``SYSCALL`` instruction modifies ``%rcx`` and ``%r11``.
+   These registers want spilling or marking as clobbered if invoking the
+   hypercall without the use of the hypercall page.

For most hypercalls this is sufficient, but ...

docs/guest-guide/x86/hypercall-abi.rst means. · line 147

Quoted 3 lines
docs/guest-guide/x86/hypercall-abi.rst +0 -0
 .. [#iret] ``HYPERCALL_iret`` is special.  It is only implemented for PV
    guests and takes all its parameters on the stack.  This stub should be
    ``jmp``'d to, rather than ``call``'d.  HVM guests have this stub

... for this one merely marking as clobbered isn't an option, aiui. It needs the two registers put on the stack, and in a specific order. At least as long as VGCF_in_syscall is clear in the stack frame.

Jan