summaryrefslogtreecommitdiff
path: root/usr/src/uts/intel
diff options
context:
space:
mode:
authormrj <none@none>2007-12-21 14:13:23 -0800
committermrj <none@none>2007-12-21 14:13:23 -0800
commit551bc2a66868b5cb5be6b70ab9f55515e77a39a9 (patch)
treea01e761c9864ea9483c468ced858a0f67edcbf93 /usr/src/uts/intel
parent71a79fe7afa36dcf0de6902c2c6ef432980534d3 (diff)
downloadillumos-gate-551bc2a66868b5cb5be6b70ab9f55515e77a39a9.tar.gz
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
6525093 xnb/xnf should use hypervisor based copy for xnb->xnf data path 6608917 members of struct xnf and xnb need unique names 6609324 deadlock trying to own the HAT migrate lock 6609805 still missing XPV_DISALLOW_MIGRATE/XPV_ALLOW_MIGRATE bracketing in hat_i86.c 6616384 xnb's grant ref unmapping is inefficient 6619947 Solaris should provide a PV network driver for xVM HVM environments 6632774 panic setting up xen console --HG-- rename : usr/src/uts/i86xpv/os/gnttab.c => usr/src/uts/common/xen/os/gnttab.c rename : usr/src/uts/i86xpv/os/hypercall.c => usr/src/uts/common/xen/os/hypercall.c rename : usr/src/uts/i86xpv/sys/gnttab.h => usr/src/uts/common/xen/sys/gnttab.h rename : usr/src/uts/i86xpv/ml/hypersubr.s => usr/src/uts/intel/ia32/ml/hypersubr.s rename : usr/src/uts/i86xpv/sys/hypervisor.h => usr/src/uts/intel/sys/hypervisor.h rename : usr/src/uts/i86xpv/sys/xen_errno.h => usr/src/uts/intel/sys/xen_errno.h
Diffstat (limited to 'usr/src/uts/intel')
-rw-r--r--usr/src/uts/intel/ia32/ml/hypersubr.s313
-rw-r--r--usr/src/uts/intel/os/name_to_major1
-rw-r--r--usr/src/uts/intel/sys/Makefile4
-rw-r--r--usr/src/uts/intel/sys/hypervisor.h238
-rw-r--r--usr/src/uts/intel/sys/xen_errno.h95
5 files changed, 650 insertions, 1 deletions
diff --git a/usr/src/uts/intel/ia32/ml/hypersubr.s b/usr/src/uts/intel/ia32/ml/hypersubr.s
new file mode 100644
index 0000000000..c50d24f7d1
--- /dev/null
+++ b/usr/src/uts/intel/ia32/ml/hypersubr.s
@@ -0,0 +1,313 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/asm_linkage.h>
+#ifdef XPV_HVM_DRIVER
+#include <sys/xpv_support.h>
+#endif
+#include <sys/hypervisor.h>
+
+/*
+ * Hypervisor "system calls"
+ *
+ * i386
+ * %eax == call number
+ * args in registers (%ebx, %ecx, %edx, %esi, %edi)
+ *
+ * amd64
+ * %rax == call number
+ * args in registers (%rdi, %rsi, %rdx, %r10, %r8, %r9)
+ *
+ * Note that for amd64 we use %r10 instead of %rcx for passing 4th argument
+ * as in C calling convention since the "syscall" instruction clobbers %rcx.
+ *
+ * (These calls can be done more efficiently as gcc-style inlines, but
+ * for simplicity and help with initial debugging, we use these primitives
+ * to build the hypervisor calls up from C wrappers.)
+ */
+
+#if defined(__lint)
+
+/*ARGSUSED*/
+long
+__hypercall0(int callnum)
+{ return (0); }
+
+/*ARGSUSED*/
+long
+__hypercall1(int callnum, ulong_t a1)
+{ return (0); }
+
+/*ARGSUSED*/
+long
+__hypercall2(int callnum, ulong_t a1, ulong_t a2)
+{ return (0); }
+
+/*ARGSUSED*/
+long
+__hypercall3(int callnum, ulong_t a1, ulong_t a2, ulong_t a3)
+{ return (0); }
+
+/*ARGSUSED*/
+long
+__hypercall4(int callnum, ulong_t a1, ulong_t a2, ulong_t a3, ulong_t a4)
+{ return (0); }
+
+/*ARGSUSED*/
+long
+__hypercall5(int callnum,
+ ulong_t a1, ulong_t a2, ulong_t a3, ulong_t a4, ulong_t a5)
+{ return (0); }
+
+/*ARGSUSED*/
+int
+__hypercall0_int(int callnum)
+{ return (0); }
+
+/*ARGSUSED*/
+int
+__hypercall1_int(int callnum, ulong_t a1)
+{ return (0); }
+
+/*ARGSUSED*/
+int
+__hypercall2_int(int callnum, ulong_t a1, ulong_t a2)
+{ return (0); }
+
+/*ARGSUSED*/
+int
+__hypercall3_int(int callnum, ulong_t a1, ulong_t a2, ulong_t a3)
+{ return (0); }
+
+/*ARGSUSED*/
+int
+__hypercall4_int(int callnum, ulong_t a1, ulong_t a2, ulong_t a3, ulong_t a4)
+{ return (0); }
+
+/*ARGSUSED*/
+int
+__hypercall5_int(int callnum,
+ ulong_t a1, ulong_t a2, ulong_t a3, ulong_t a4, ulong_t a5)
+{ return (0); }
+
+#else /* __lint */
+
+/*
+ * XXPV grr - assembler can't deal with an instruction in a quoted string
+ */
+#undef TRAP_INSTR /* cause it's currently "int $0x82" */
+
+/*
+ * The method for issuing a hypercall (i.e. a system call to the
+ * hypervisor) varies from platform to platform. In 32-bit PV domains, an
+ * 'int 82' triggers the call. In 64-bit PV domains, a 'syscall' does the
+ * trick.
+ *
+ * HVM domains are more complicated. In all cases, we want to issue a
+ * VMEXIT instruction, but AMD and Intel use different opcodes to represent
+ * that instruction. Rather than build CPU-specific modules with the
+ * different opcodes, we use the 'hypercall page' provided by Xen. This
+ * page contains a collection of code stubs that do nothing except issue
+ * hypercalls using the proper instructions for this machine. To keep the
+ * wrapper code as simple and efficient as possible, we preallocate that
+ * page below. When the module is loaded, we ask Xen to remap the
+ * underlying PFN to that of the hypercall page.
+ *
+ * Note: this same mechanism could be used in PV domains, but using
+ * hypercall page requires a call and several more instructions than simply
+ * issuing the proper trap.
+ */
+#if defined(XPV_HVM_DRIVER)
+
+#define HYPERCALL_PAGESIZE 0x1000
+ .text
+ .align HYPERCALL_PAGESIZE
+ .globl hypercall_page
+ .type hypercall_page, @function
+hypercall_page:
+ .skip HYPERCALL_PAGESIZE
+ .size hypercall_page, HYPERCALL_PAGESIZE
+#if defined(__amd64)
+#define TRAP_INSTR \
+ shll $5, %eax; \
+ addq $hypercall_page, %rax; \
+ jmp *%rax
+#else
+#define TRAP_INSTR \
+ shll $5, %eax; \
+ addl $hypercall_page, %eax; \
+ call *%eax
+#endif
+
+#else /* XPV_HVM_DRIVER */
+
+#if defined(__amd64)
+#define TRAP_INSTR syscall
+#elif defined(__i386)
+#define TRAP_INSTR int $0x82
+#endif
+#endif /* XPV_HVM_DRIVER */
+
+
+#if defined(__amd64)
+
+ ENTRY_NP(__hypercall0)
+ ALTENTRY(__hypercall0_int)
+ movl %edi, %eax
+ TRAP_INSTR
+ ret
+ SET_SIZE(__hypercall0)
+
+ ENTRY_NP(__hypercall1)
+ ALTENTRY(__hypercall1_int)
+ movl %edi, %eax
+ movq %rsi, %rdi /* arg 1 */
+ TRAP_INSTR
+ ret
+ SET_SIZE(__hypercall1)
+
+ ENTRY_NP(__hypercall2)
+ ALTENTRY(__hypercall2_int)
+ movl %edi, %eax
+ movq %rsi, %rdi /* arg 1 */
+ movq %rdx, %rsi /* arg 2 */
+ TRAP_INSTR
+ ret
+ SET_SIZE(__hypercall2)
+
+ ENTRY_NP(__hypercall3)
+ ALTENTRY(__hypercall3_int)
+ movl %edi, %eax
+ movq %rsi, %rdi /* arg 1 */
+ movq %rdx, %rsi /* arg 2 */
+ movq %rcx, %rdx /* arg 3 */
+ TRAP_INSTR
+ ret
+ SET_SIZE(__hypercall3)
+
+ ENTRY_NP(__hypercall4)
+ ALTENTRY(__hypercall4_int)
+ movl %edi, %eax
+ movq %rsi, %rdi /* arg 1 */
+ movq %rdx, %rsi /* arg 2 */
+ movq %rcx, %rdx /* arg 3 */
+ movq %r8, %r10 /* r10 = 4th arg */
+ TRAP_INSTR
+ ret
+ SET_SIZE(__hypercall4)
+
+ ENTRY_NP(__hypercall5)
+ ALTENTRY(__hypercall5_int)
+ movl %edi, %eax
+ movq %rsi, %rdi /* arg 1 */
+ movq %rdx, %rsi /* arg 2 */
+ movq %rcx, %rdx /* arg 3 */
+ movq %r8, %r10 /* r10 = 4th arg */
+ movq %r9, %r8 /* arg 5 */
+ TRAP_INSTR
+ ret
+ SET_SIZE(__hypercall5)
+
+#elif defined(__i386)
+
+ ENTRY_NP(__hypercall0)
+ ALTENTRY(__hypercall0_int)
+ movl 4(%esp), %eax
+ TRAP_INSTR
+ ret
+ SET_SIZE(__hypercall0)
+
+ ENTRY_NP(__hypercall1)
+ ALTENTRY(__hypercall1_int)
+ pushl %ebx
+ movl 8(%esp), %eax
+ movl 12(%esp), %ebx
+ TRAP_INSTR
+ popl %ebx
+ ret
+ SET_SIZE(__hypercall1)
+
+ ENTRY_NP(__hypercall2)
+ ALTENTRY(__hypercall2_int)
+ pushl %ebx
+ movl 8(%esp), %eax
+ movl 12(%esp), %ebx
+ movl 16(%esp), %ecx
+ TRAP_INSTR
+ popl %ebx
+ ret
+ SET_SIZE(__hypercall2)
+
+ ENTRY_NP(__hypercall3)
+ ALTENTRY(__hypercall3_int)
+ pushl %ebx
+ movl 8(%esp), %eax
+ movl 12(%esp), %ebx
+ movl 16(%esp), %ecx
+ movl 20(%esp), %edx
+ TRAP_INSTR
+ popl %ebx
+ ret
+ SET_SIZE(__hypercall3)
+
+ ENTRY_NP(__hypercall4)
+ ALTENTRY(__hypercall4_int)
+ pushl %ebx
+ pushl %esi
+ movl 12(%esp), %eax
+ movl 16(%esp), %ebx
+ movl 20(%esp), %ecx
+ movl 24(%esp), %edx
+ movl 28(%esp), %esi
+ TRAP_INSTR
+ popl %esi
+ popl %ebx
+ ret
+ SET_SIZE(__hypercall4)
+
+ ENTRY_NP(__hypercall5)
+ ALTENTRY(__hypercall5_int)
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ movl 16(%esp), %eax
+ movl 20(%esp), %ebx
+ movl 24(%esp), %ecx
+ movl 28(%esp), %edx
+ movl 32(%esp), %esi
+ movl 36(%esp), %edi
+ TRAP_INSTR
+ popl %edi
+ popl %esi
+ popl %ebx
+ ret
+ SET_SIZE(__hypercall5)
+
+#endif /* __i386 */
+
+#endif /* lint */
diff --git a/usr/src/uts/intel/os/name_to_major b/usr/src/uts/intel/os/name_to_major
index de3388721c..56e10ff720 100644
--- a/usr/src/uts/intel/os/name_to_major
+++ b/usr/src/uts/intel/os/name_to_major
@@ -117,6 +117,7 @@ kssl 185
mc-amd 186
tzmon 187
intel_nb5000 188
+xpv 190
xpvd 191
xnf 192
xdf 193
diff --git a/usr/src/uts/intel/sys/Makefile b/usr/src/uts/intel/sys/Makefile
index 3296cb5735..0d523cc8ac 100644
--- a/usr/src/uts/intel/sys/Makefile
+++ b/usr/src/uts/intel/sys/Makefile
@@ -47,6 +47,7 @@ HDRS = \
fp.h \
frame.h \
inline.h \
+ hypervisor.h \
kd.h \
kdi_machimpl.h \
kdi_regs.h \
@@ -92,7 +93,8 @@ HDRS = \
ucontext.h \
utrap.h \
vmparam.h \
- x86_archext.h
+ x86_archext.h \
+ xen_errno.h
CLOSEDHDRS = \
memtest.h \
diff --git a/usr/src/uts/intel/sys/hypervisor.h b/usr/src/uts/intel/sys/hypervisor.h
new file mode 100644
index 0000000000..9f5aadd499
--- /dev/null
+++ b/usr/src/uts/intel/sys/hypervisor.h
@@ -0,0 +1,238 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ *
+ * Communication to/from hypervisor.
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef _SYS_HYPERVISOR_H
+#define _SYS_HYPERVISOR_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef XPV_HVM_DRIVER
+#include <sys/xpv_support.h>
+#else
+#include <sys/xpv_impl.h>
+#endif
+#include <sys/xen_errno.h>
+
+#if !defined(_ASM)
+
+#include <sys/processor.h>
+#include <sys/cpuvar.h>
+#ifndef XPV_HVM_DRIVER
+#include <sys/xen_mmu.h>
+#endif
+#include <sys/systm.h>
+#include <xen/public/callback.h>
+#include <xen/public/event_channel.h>
+#include <xen/public/grant_table.h>
+#include <xen/public/io/blkif.h>
+#include <xen/public/io/xenbus.h>
+#include <xen/public/memory.h>
+#include <xen/public/nmi.h>
+#include <xen/public/physdev.h>
+#include <xen/public/sched.h>
+#include <xen/public/sysctl.h>
+#include <xen/public/platform.h>
+#include <xen/public/vcpu.h>
+#include <xen/public/version.h>
+#include <xen/public/acm_ops.h>
+#include <xen/public/hvm/params.h>
+
+extern shared_info_t *HYPERVISOR_shared_info;
+extern void *HYPERVISOR_console_page;
+
+/* -- move these definitions elsewhere -- */
+
+extern int xen_debug_handler(void *);
+extern void xen_printf(const char *, ...) __KPRINTFLIKE(1);
+#pragma rarely_called(xen_printf)
+
+extern void xen_callback(void);
+extern void xen_failsafe_callback(void);
+
+extern hrtime_t xpv_gethrtime(void);
+extern hrtime_t xpv_getsystime(void);
+
+extern void xpv_time_suspend(void);
+extern void xpv_time_resume(void);
+
+extern void startup_xen_version(void);
+
+extern void mach_cpucontext_reset(cpu_t *);
+extern void mach_cpucontext_restore(cpu_t *);
+
+extern void mp_enter_barrier(void);
+extern void mp_leave_barrier(void);
+
+extern cpuset_t cpu_suspend_lost_set;
+
+extern int xen_gdt_setprot(cpu_t *, uint_t);
+extern int xen_ldt_setprot(user_desc_t *, size_t, uint_t);
+
+/*
+ * Wrappered versions of the hypercalls that diagnose/panic on failure
+ */
+extern void xen_set_gdt(ulong_t *, int);
+extern void xen_set_ldt(user_desc_t *, uint_t);
+extern void xen_stack_switch(ulong_t, ulong_t);
+extern long xen_set_trap_table(trap_info_t *);
+
+#if defined(__amd64)
+extern void xen_set_segment_base(int, ulong_t);
+#endif /* __amd64 */
+extern long xen_vcpu_up(processorid_t);
+extern long xen_vcpu_down(processorid_t);
+extern void xen_enable_user_iopl(void);
+extern void xen_disable_user_iopl(void);
+
+/*
+ * A quick way to ask if we're DOM0 or not ..
+ */
+#ifdef XPV_HVM_DRIVER
+
+#define DOMAIN_IS_INITDOMAIN(info) (__lintzero)
+#define DOMAIN_IS_PRIVILEGED(info) (__lintzero)
+
+#else
+
+#define DOMAIN_IS_INITDOMAIN(info) \
+ (((info)->flags & SIF_INITDOMAIN) == SIF_INITDOMAIN)
+
+#define DOMAIN_IS_PRIVILEGED(info) \
+ (((info)->flags & SIF_PRIVILEGED) == SIF_PRIVILEGED)
+
+#endif
+
+/*
+ * start of day information passed up from the hypervisor
+ */
+extern start_info_t *xen_info;
+
+extern long __hypercall0(int);
+extern long __hypercall1(int, ulong_t);
+extern long __hypercall2(int, ulong_t, ulong_t);
+extern long __hypercall3(int, ulong_t, ulong_t, ulong_t);
+extern long __hypercall4(int, ulong_t, ulong_t, ulong_t, ulong_t);
+extern long __hypercall5(int, ulong_t, ulong_t, ulong_t, ulong_t, ulong_t);
+
+extern int __hypercall0_int(int);
+extern int __hypercall1_int(int, ulong_t);
+extern int __hypercall2_int(int, ulong_t, ulong_t);
+extern int __hypercall3_int(int, ulong_t, ulong_t, ulong_t);
+extern int __hypercall4_int(int, ulong_t, ulong_t, ulong_t, ulong_t);
+extern int __hypercall5_int(int, ulong_t, ulong_t, ulong_t, ulong_t, ulong_t);
+
+extern long HYPERVISOR_set_trap_table(trap_info_t *);
+extern int HYPERVISOR_mmu_update(mmu_update_t *, int, int *, domid_t);
+extern long HYPERVISOR_set_gdt(ulong_t *, int);
+extern long HYPERVISOR_stack_switch(ulong_t, ulong_t);
+#if defined(__amd64)
+extern long HYPERVISOR_set_callbacks(ulong_t, ulong_t, ulong_t);
+#else
+extern long HYPERVISOR_set_callbacks(ulong_t, ulong_t, ulong_t, ulong_t);
+#endif
+extern long HYPERVISOR_fpu_taskswitch(int);
+/* *** __HYPERVISOR_sched_op_compat *** OBSOLETED */
+extern long HYPERVISOR_platform_op(xen_platform_op_t *);
+/* *** __HYPERVISOR_set_debugreg *** NOT IMPLEMENTED */
+/* *** __HYPERVISOR_get_debugreg *** NOT IMPLEMENTED */
+extern long HYPERVISOR_update_descriptor(maddr_t, uint64_t);
+extern long HYPERVISOR_memory_op(int, void *);
+extern long HYPERVISOR_multicall(void *, uint_t);
+extern int HYPERVISOR_update_va_mapping(ulong_t, uint64_t, ulong_t);
+extern long HYPERVISOR_set_timer_op(uint64_t);
+/* *** __HYPERVISOR_event_channel_op_compat *** OBSOLETED */
+extern long HYPERVISOR_xen_version(int, void *);
+extern long HYPERVISOR_console_io(int, int, char *);
+/* *** __HYPERVISOR_physdev_op_compat *** OBSOLETED */
+extern long HYPERVISOR_grant_table_op(unsigned int, void *, unsigned int);
+extern long HYPERVISOR_vm_assist(unsigned int, unsigned int);
+extern int HYPERVISOR_update_va_mapping_otherdomain(ulong_t,
+ uint64_t, ulong_t, domid_t);
+/* *** __HYPERVISOR_iret *** IN i86xpv/sys/machprivregs.h */
+extern long HYPERVISOR_vcpu_op(int, int, void *);
+#if defined(__amd64)
+extern long HYPERVISOR_set_segment_base(int, ulong_t);
+#endif /* __amd64 */
+extern int HYPERVISOR_mmuext_op(struct mmuext_op *, int, uint_t *, domid_t);
+extern long HYPERVISOR_acm_op(int cmd, void *);
+extern long HYPERVISOR_nmi_op(int cmd, void *);
+extern long HYPERVISOR_sched_op(int, void *);
+extern long HYPERVISOR_callback_op(int, void *);
+/* *** __HYPERVISOR_xenoprof_op *** NOT IMPLEMENTED */
+extern long HYPERVISOR_event_channel_op(int, void *); /* does return long */
+extern long HYPERVISOR_physdev_op(int, void *);
+extern long HYPERVISOR_hvm_op(int cmd, void *);
+extern long HYPERVISOR_sysctl(xen_sysctl_t *);
+extern long HYPERVISOR_domctl(xen_domctl_t *domctl);
+/* *** __HYPERVISOR_kexec_op *** NOT IMPLEMENTED */
+
+
+/*
+ * HYPERCALL HELPER ROUTINES
+ * These don't have their own unique hypercalls.
+ */
+extern long HYPERVISOR_yield(void);
+extern long HYPERVISOR_block(void);
+extern long HYPERVISOR_shutdown(uint_t);
+extern long HYPERVISOR_poll(evtchn_port_t *, uint_t, uint64_t);
+extern long HYPERVISOR_suspend(ulong_t);
+
+#endif /* !_ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_HYPERVISOR_H */
diff --git a/usr/src/uts/intel/sys/xen_errno.h b/usr/src/uts/intel/sys/xen_errno.h
new file mode 100644
index 0000000000..35a6586eaf
--- /dev/null
+++ b/usr/src/uts/intel/sys/xen_errno.h
@@ -0,0 +1,95 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_XEN_ERRNO_H
+#define _SYS_XEN_ERRNO_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Xen errno's for HYPERVISOR calls
+ *
+ * XXPV This is maintained by hand :(
+ *
+ * Unfortunately native Xen currently uses the same namespace as the Solaris
+ * errno namespace but with (some) different numeric values.
+ *
+ * This set of errno values match Xen 3.0.3; sigh.
+ *
+ * In a better world, Xen would make it's namespace explicitly different
+ * e.g. something like below.
+ */
+
+#define X_EPERM 1
+#define X_ENOENT 2
+#define X_ESRCH 3
+#define X_EINTR 4
+#define X_EIO 5
+#define X_ENXIO 6
+#define X_E2BIG 7
+
+#define X_ENOMEM 12
+#define X_EACCES 13
+#define X_EFAULT 14
+
+#define X_EBUSY 16
+#define X_EEXIST 17
+
+#define X_ENODEV 19
+#define X_EISDIR 21
+#define X_EINVAL 22
+
+#define X_ENOSPC 28
+#define X_ESPIPE 29
+#define X_EROFS 30
+
+#define X_ENOSYS 38
+#define X_ENOTEMPTY 39
+
+#define X_ENODATA 61
+
+#define X_EISCONN 106
+
+#ifndef _ASM
+#if defined(_KERNEL)
+/*
+ * Error code translation routine to translate xen error codes to
+ * Solaris error codes. Xen returns negative error codes which this
+ * routine will translate to a positive one.
+ */
+extern int xen_xlate_errcode(int);
+#endif /* _KERNEL */
+#endif /* _ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_XEN_ERRNO_H */