[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEN] Clarify x86 hypercall ABI in public header comments.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID 5fc1fe79083517824d89309cc618f21302724e29
# Parent  26576f1dbadb4ab6b6266afb7c6984573929547f
[XEN] Clarify x86 hypercall ABI in public header comments.
In particular: x86/64 *does* clobber its ragument registers
(just like i386). This happens in debug builds, and if a
continuation is created.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/include/public/arch-x86_32.h |   22 +++++++++++++++++++---
 xen/include/public/arch-x86_64.h |   22 +++++++++++++++++++---
 xen/include/public/xen.h         |   14 +++-----------
 3 files changed, 41 insertions(+), 17 deletions(-)

diff -r 26576f1dbadb -r 5fc1fe790835 xen/include/public/arch-x86_32.h
--- a/xen/include/public/arch-x86_32.h  Sat Aug 19 14:28:10 2006 +0100
+++ b/xen/include/public/arch-x86_32.h  Sat Aug 19 17:07:54 2006 +0100
@@ -8,6 +8,25 @@
 
 #ifndef __XEN_PUBLIC_ARCH_X86_32_H__
 #define __XEN_PUBLIC_ARCH_X86_32_H__
+
+/*
+ * Hypercall interface:
+ *  Input:  %ebx, %ecx, %edx, %esi, %edi (arguments 1-5)
+ *  Output: %eax
+ * Access is via hypercall page (set up by guest loader or via a Xen MSR):
+ *  call hypercall_page + hypercall-number * 32
+ * Clobbered: Argument registers (e.g., 2-arg hypercall clobbers %ebx,%ecx)
+ */
+
+#if __XEN_INTERFACE_VERSION__ < 0x00030203
+/*
+ * Legacy hypercall interface:
+ * As above, except the entry sequence to the hypervisor is:
+ *  mov $hypercall-number*32,%eax ; int $0x82
+ */
+#define TRAP_INSTR "int $0x82"
+#endif
+
 
 /* Structural guest handles introduced in 0x00030201. */
 #if __XEN_INTERFACE_VERSION__ >= 0x00030201
@@ -70,9 +89,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define FLAT_USER_CS    FLAT_RING3_CS
 #define FLAT_USER_DS    FLAT_RING3_DS
 #define FLAT_USER_SS    FLAT_RING3_SS
-
-/* And the trap vector is... */
-#define TRAP_INSTR "int $0x82"
 
 /*
  * Virtual addresses beyond this are not modifiable by guest OSes. The 
diff -r 26576f1dbadb -r 5fc1fe790835 xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h  Sat Aug 19 14:28:10 2006 +0100
+++ b/xen/include/public/arch-x86_64.h  Sat Aug 19 17:07:54 2006 +0100
@@ -8,6 +8,25 @@
 
 #ifndef __XEN_PUBLIC_ARCH_X86_64_H__
 #define __XEN_PUBLIC_ARCH_X86_64_H__
+
+/*
+ * Hypercall interface:
+ *  Input:  %rdi, %rsi, %rdx, %r10, %r8 (arguments 1-5)
+ *  Output: %rax
+ * Access is via hypercall page (set up by guest loader or via a Xen MSR):
+ *  call hypercall_page + hypercall-number * 32
+ * Clobbered: argument registers (e.g., 2-arg hypercall clobbers %rdi,%rsi)
+ */
+
+#if __XEN_INTERFACE_VERSION__ < 0x00030203
+/*
+ * Legacy hypercall interface:
+ * As above, except the entry sequence to the hypervisor is:
+ *  mov $hypercall-number*32,%eax ; syscall
+ * Clobbered: %rcx, %r11, argument registers (as above)
+ */
+#define TRAP_INSTR "syscall"
+#endif
 
 /* Structural guest handles introduced in 0x00030201. */
 #if __XEN_INTERFACE_VERSION__ >= 0x00030201
@@ -85,9 +104,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define FLAT_USER_SS64 FLAT_RING3_SS64
 #define FLAT_USER_SS32 FLAT_RING3_SS32
 #define FLAT_USER_SS   FLAT_USER_SS64
-
-/* And the trap vector is... */
-#define TRAP_INSTR "syscall"
 
 #define __HYPERVISOR_VIRT_START 0xFFFF800000000000
 #define __HYPERVISOR_VIRT_END   0xFFFF880000000000
diff -r 26576f1dbadb -r 5fc1fe790835 xen/include/public/xen.h
--- a/xen/include/public/xen.h  Sat Aug 19 14:28:10 2006 +0100
+++ b/xen/include/public/xen.h  Sat Aug 19 17:07:54 2006 +0100
@@ -24,17 +24,9 @@
 #endif
 
 /*
- * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
- */
-
-/*
- * x86_32: EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5.
- *         EAX = return value
- *         (argument registers may be clobbered on return)
- * x86_64: RAX = vector; RDI, RSI, RDX, R10, R8, R9 = args 1, 2, 3, 4, 5, 6. 
- *         RAX = return value
- *         (argument registers not clobbered on return; RCX, R11 are)
- */
+ * HYPERCALLS
+ */
+
 #define __HYPERVISOR_set_trap_table        0
 #define __HYPERVISOR_mmu_update            1
 #define __HYPERVISOR_set_gdt               2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.