ia64/xen-unstable

changeset 8972:323d40eefbce

Update the hypercalls in Mini-OS to reflect the current state in XenLinux.

Signed-off-by: Aravindh Puthiyaparambil <aravindh.puthiyaparambil@unisys.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Feb 23 11:27:35 2006 +0100 (2006-02-23)
parents cb14f4db7a1e
children 5bf4d9a9694f
files extras/mini-os/include/hypercall-x86_32.h extras/mini-os/include/hypercall-x86_64.h extras/mini-os/include/hypervisor.h extras/mini-os/x86_32.S extras/mini-os/x86_64.S
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extras/mini-os/include/hypercall-x86_32.h	Thu Feb 23 11:27:35 2006 +0100
     1.3 @@ -0,0 +1,326 @@
     1.4 +/******************************************************************************
     1.5 + * hypercall-x86_32.h
     1.6 + * 
     1.7 + * Copied from XenLinux.
     1.8 + * 
     1.9 + * Copyright (c) 2002-2004, K A Fraser
    1.10 + * 
    1.11 + * This file may be distributed separately from the Linux kernel, or
    1.12 + * incorporated into other software packages, subject to the following license:
    1.13 + * 
    1.14 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    1.15 + * of this source file (the "Software"), to deal in the Software without
    1.16 + * restriction, including without limitation the rights to use, copy, modify,
    1.17 + * merge, publish, distribute, sublicense, and/or sell copies of the Software,
    1.18 + * and to permit persons to whom the Software is furnished to do so, subject to
    1.19 + * the following conditions:
    1.20 + * 
    1.21 + * The above copyright notice and this permission notice shall be included in
    1.22 + * all copies or substantial portions of the Software.
    1.23 + * 
    1.24 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.25 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.26 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    1.27 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    1.28 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    1.29 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    1.30 + * IN THE SOFTWARE.
    1.31 + */
    1.32 +
    1.33 +#ifndef __HYPERCALL_X86_32_H__
    1.34 +#define __HYPERCALL_X86_32_H__
    1.35 +
    1.36 +#include <xen/xen.h>
    1.37 +#include <xen/sched.h>
    1.38 +#include <xen/nmi.h>
    1.39 +#include <mm.h>
    1.40 +
    1.41 +#define __STR(x) #x
    1.42 +#define STR(x) __STR(x)
    1.43 +
    1.44 +extern char hypercall_page[PAGE_SIZE];
    1.45 +
    1.46 +#define _hypercall0(type, name)			\
    1.47 +({						\
    1.48 +	long __res;				\
    1.49 +	asm volatile (				\
    1.50 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    1.51 +		: "=a" (__res)			\
    1.52 +		:				\
    1.53 +		: "memory" );			\
    1.54 +	(type)__res;				\
    1.55 +})
    1.56 +
    1.57 +#define _hypercall1(type, name, a1)				\
    1.58 +({								\
    1.59 +	long __res, __ign1;					\
    1.60 +	asm volatile (						\
    1.61 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    1.62 +		: "=a" (__res), "=b" (__ign1)			\
    1.63 +		: "1" ((long)(a1))				\
    1.64 +		: "memory" );					\
    1.65 +	(type)__res;						\
    1.66 +})
    1.67 +
    1.68 +#define _hypercall2(type, name, a1, a2)				\
    1.69 +({								\
    1.70 +	long __res, __ign1, __ign2;				\
    1.71 +	asm volatile (						\
    1.72 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    1.73 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2)	\
    1.74 +		: "1" ((long)(a1)), "2" ((long)(a2))		\
    1.75 +		: "memory" );					\
    1.76 +	(type)__res;						\
    1.77 +})
    1.78 +
    1.79 +#define _hypercall3(type, name, a1, a2, a3)			\
    1.80 +({								\
    1.81 +	long __res, __ign1, __ign2, __ign3;			\
    1.82 +	asm volatile (						\
    1.83 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    1.84 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2), 	\
    1.85 +		"=d" (__ign3)					\
    1.86 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
    1.87 +		"3" ((long)(a3))				\
    1.88 +		: "memory" );					\
    1.89 +	(type)__res;						\
    1.90 +})
    1.91 +
    1.92 +#define _hypercall4(type, name, a1, a2, a3, a4)			\
    1.93 +({								\
    1.94 +	long __res, __ign1, __ign2, __ign3, __ign4;		\
    1.95 +	asm volatile (						\
    1.96 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    1.97 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
    1.98 +		"=d" (__ign3), "=S" (__ign4)			\
    1.99 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
   1.100 +		"3" ((long)(a3)), "4" ((long)(a4))		\
   1.101 +		: "memory" );					\
   1.102 +	(type)__res;						\
   1.103 +})
   1.104 +
   1.105 +#define _hypercall5(type, name, a1, a2, a3, a4, a5)		\
   1.106 +({								\
   1.107 +	long __res, __ign1, __ign2, __ign3, __ign4, __ign5;	\
   1.108 +	asm volatile (						\
   1.109 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   1.110 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
   1.111 +		"=d" (__ign3), "=S" (__ign4), "=D" (__ign5)	\
   1.112 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
   1.113 +		"3" ((long)(a3)), "4" ((long)(a4)),		\
   1.114 +		"5" ((long)(a5))				\
   1.115 +		: "memory" );					\
   1.116 +	(type)__res;						\
   1.117 +})
   1.118 +
   1.119 +static inline int
   1.120 +HYPERVISOR_set_trap_table(
   1.121 +	trap_info_t *table)
   1.122 +{
   1.123 +	return _hypercall1(int, set_trap_table, table);
   1.124 +}
   1.125 +
   1.126 +static inline int
   1.127 +HYPERVISOR_mmu_update(
   1.128 +	mmu_update_t *req, int count, int *success_count, domid_t domid)
   1.129 +{
   1.130 +	return _hypercall4(int, mmu_update, req, count, success_count, domid);
   1.131 +}
   1.132 +
   1.133 +static inline int
   1.134 +HYPERVISOR_mmuext_op(
   1.135 +	struct mmuext_op *op, int count, int *success_count, domid_t domid)
   1.136 +{
   1.137 +	return _hypercall4(int, mmuext_op, op, count, success_count, domid);
   1.138 +}
   1.139 +
   1.140 +static inline int
   1.141 +HYPERVISOR_set_gdt(
   1.142 +	unsigned long *frame_list, int entries)
   1.143 +{
   1.144 +	return _hypercall2(int, set_gdt, frame_list, entries);
   1.145 +}
   1.146 +
   1.147 +static inline int
   1.148 +HYPERVISOR_stack_switch(
   1.149 +	unsigned long ss, unsigned long esp)
   1.150 +{
   1.151 +	return _hypercall2(int, stack_switch, ss, esp);
   1.152 +}
   1.153 +
   1.154 +static inline int
   1.155 +HYPERVISOR_set_callbacks(
   1.156 +	unsigned long event_selector, unsigned long event_address,
   1.157 +	unsigned long failsafe_selector, unsigned long failsafe_address)
   1.158 +{
   1.159 +	return _hypercall4(int, set_callbacks,
   1.160 +			   event_selector, event_address,
   1.161 +			   failsafe_selector, failsafe_address);
   1.162 +}
   1.163 +
   1.164 +static inline int
   1.165 +HYPERVISOR_fpu_taskswitch(
   1.166 +	int set)
   1.167 +{
   1.168 +	return _hypercall1(int, fpu_taskswitch, set);
   1.169 +}
   1.170 +
   1.171 +static inline int
   1.172 +HYPERVISOR_sched_op(
   1.173 +	int cmd, unsigned long arg)
   1.174 +{
   1.175 +	return _hypercall2(int, sched_op, cmd, arg);
   1.176 +}
   1.177 +
   1.178 +static inline long
   1.179 +HYPERVISOR_set_timer_op(
   1.180 +	u64 timeout)
   1.181 +{
   1.182 +	unsigned long timeout_hi = (unsigned long)(timeout>>32);
   1.183 +	unsigned long timeout_lo = (unsigned long)timeout;
   1.184 +	return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
   1.185 +}
   1.186 +
   1.187 +static inline int
   1.188 +HYPERVISOR_dom0_op(
   1.189 +	dom0_op_t *dom0_op)
   1.190 +{
   1.191 +	dom0_op->interface_version = DOM0_INTERFACE_VERSION;
   1.192 +	return _hypercall1(int, dom0_op, dom0_op);
   1.193 +}
   1.194 +
   1.195 +static inline int
   1.196 +HYPERVISOR_set_debugreg(
   1.197 +	int reg, unsigned long value)
   1.198 +{
   1.199 +	return _hypercall2(int, set_debugreg, reg, value);
   1.200 +}
   1.201 +
   1.202 +static inline unsigned long
   1.203 +HYPERVISOR_get_debugreg(
   1.204 +	int reg)
   1.205 +{
   1.206 +	return _hypercall1(unsigned long, get_debugreg, reg);
   1.207 +}
   1.208 +
   1.209 +static inline int
   1.210 +HYPERVISOR_update_descriptor(
   1.211 +	u64 ma, u64 desc)
   1.212 +{
   1.213 +	return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
   1.214 +}
   1.215 +
   1.216 +static inline int
   1.217 +HYPERVISOR_memory_op(
   1.218 +	unsigned int cmd, void *arg)
   1.219 +{
   1.220 +	return _hypercall2(int, memory_op, cmd, arg);
   1.221 +}
   1.222 +
   1.223 +static inline int
   1.224 +HYPERVISOR_multicall(
   1.225 +	void *call_list, int nr_calls)
   1.226 +{
   1.227 +	return _hypercall2(int, multicall, call_list, nr_calls);
   1.228 +}
   1.229 +
   1.230 +static inline int
   1.231 +HYPERVISOR_update_va_mapping(
   1.232 +	unsigned long va, pte_t new_val, unsigned long flags)
   1.233 +{
   1.234 +	unsigned long pte_hi = 0;
   1.235 +#ifdef CONFIG_X86_PAE
   1.236 +	pte_hi = new_val.pte_high;
   1.237 +#endif
   1.238 +	return _hypercall4(int, update_va_mapping, va,
   1.239 +			   new_val.pte_low, pte_hi, flags);
   1.240 +}
   1.241 +
   1.242 +static inline int
   1.243 +HYPERVISOR_event_channel_op(
   1.244 +	void *op)
   1.245 +{
   1.246 +	return _hypercall1(int, event_channel_op, op);
   1.247 +}
   1.248 +
   1.249 +static inline int
   1.250 +HYPERVISOR_xen_version(
   1.251 +	int cmd, void *arg)
   1.252 +{
   1.253 +	return _hypercall2(int, xen_version, cmd, arg);
   1.254 +}
   1.255 +
   1.256 +static inline int
   1.257 +HYPERVISOR_console_io(
   1.258 +	int cmd, int count, char *str)
   1.259 +{
   1.260 +	return _hypercall3(int, console_io, cmd, count, str);
   1.261 +}
   1.262 +
   1.263 +static inline int
   1.264 +HYPERVISOR_physdev_op(
   1.265 +	void *physdev_op)
   1.266 +{
   1.267 +	return _hypercall1(int, physdev_op, physdev_op);
   1.268 +}
   1.269 +
   1.270 +static inline int
   1.271 +HYPERVISOR_grant_table_op(
   1.272 +	unsigned int cmd, void *uop, unsigned int count)
   1.273 +{
   1.274 +	return _hypercall3(int, grant_table_op, cmd, uop, count);
   1.275 +}
   1.276 +
   1.277 +static inline int
   1.278 +HYPERVISOR_update_va_mapping_otherdomain(
   1.279 +	unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
   1.280 +{
   1.281 +	unsigned long pte_hi = 0;
   1.282 +#ifdef CONFIG_X86_PAE
   1.283 +	pte_hi = new_val.pte_high;
   1.284 +#endif
   1.285 +	return _hypercall5(int, update_va_mapping_otherdomain, va,
   1.286 +			   new_val.pte_low, pte_hi, flags, domid);
   1.287 +}
   1.288 +
   1.289 +static inline int
   1.290 +HYPERVISOR_vm_assist(
   1.291 +	unsigned int cmd, unsigned int type)
   1.292 +{
   1.293 +	return _hypercall2(int, vm_assist, cmd, type);
   1.294 +}
   1.295 +
   1.296 +static inline int
   1.297 +HYPERVISOR_vcpu_op(
   1.298 +	int cmd, int vcpuid, void *extra_args)
   1.299 +{
   1.300 +	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
   1.301 +}
   1.302 +
   1.303 +static inline int
   1.304 +HYPERVISOR_suspend(
   1.305 +	unsigned long srec)
   1.306 +{
   1.307 +	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
   1.308 +			   SHUTDOWN_suspend, srec);
   1.309 +}
   1.310 +
   1.311 +static inline int
   1.312 +HYPERVISOR_nmi_op(
   1.313 +	unsigned long op,
   1.314 +	unsigned long arg)
   1.315 +{
   1.316 +	return _hypercall2(int, nmi_op, op, arg);
   1.317 +}
   1.318 +
   1.319 +#endif /* __HYPERCALL_X86_32_H__ */
   1.320 +
   1.321 +/*
   1.322 + * Local variables:
   1.323 + *  c-file-style: "linux"
   1.324 + *  indent-tabs-mode: t
   1.325 + *  c-indent-level: 8
   1.326 + *  c-basic-offset: 8
   1.327 + *  tab-width: 8
   1.328 + * End:
   1.329 + */
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/extras/mini-os/include/hypercall-x86_64.h	Thu Feb 23 11:27:35 2006 +0100
     2.3 @@ -0,0 +1,326 @@
     2.4 +/******************************************************************************
     2.5 + * hypercall-x86_64.h
     2.6 + * 
     2.7 + * Copied from XenLinux.
     2.8 + * 
     2.9 + * Copyright (c) 2002-2004, K A Fraser
    2.10 + * 
    2.11 + * 64-bit updates:
    2.12 + *   Benjamin Liu <benjamin.liu@intel.com>
    2.13 + *   Jun Nakajima <jun.nakajima@intel.com>
    2.14 + * 
    2.15 + * This file may be distributed separately from the Linux kernel, or
    2.16 + * incorporated into other software packages, subject to the following license:
    2.17 + * 
    2.18 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    2.19 + * of this source file (the "Software"), to deal in the Software without
    2.20 + * restriction, including without limitation the rights to use, copy, modify,
    2.21 + * merge, publish, distribute, sublicense, and/or sell copies of the Software,
    2.22 + * and to permit persons to whom the Software is furnished to do so, subject to
    2.23 + * the following conditions:
    2.24 + * 
    2.25 + * The above copyright notice and this permission notice shall be included in
    2.26 + * all copies or substantial portions of the Software.
    2.27 + * 
    2.28 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.29 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.30 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.31 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.32 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    2.33 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    2.34 + * IN THE SOFTWARE.
    2.35 + */
    2.36 +
    2.37 +#ifndef __HYPERCALL_X86_64_H__
    2.38 +#define __HYPERCALL_X86_64_H__
    2.39 +
    2.40 +#include <xen/xen.h>
    2.41 +#include <xen/sched.h>
    2.42 +#include <mm.h>
    2.43 +
    2.44 +#define __STR(x) #x
    2.45 +#define STR(x) __STR(x)
    2.46 +
    2.47 +extern char hypercall_page[PAGE_SIZE];
    2.48 +
    2.49 +#define _hypercall0(type, name)			\
    2.50 +({						\
    2.51 +	long __res;				\
    2.52 +	asm volatile (				\
    2.53 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    2.54 +		: "=a" (__res)			\
    2.55 +		:				\
    2.56 +		: "memory" );			\
    2.57 +	(type)__res;				\
    2.58 +})
    2.59 +
    2.60 +#define _hypercall1(type, name, a1)				\
    2.61 +({								\
    2.62 +	long __res, __ign1;					\
    2.63 +	asm volatile (						\
    2.64 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    2.65 +		: "=a" (__res), "=D" (__ign1)			\
    2.66 +		: "1" ((long)(a1))				\
    2.67 +		: "memory" );					\
    2.68 +	(type)__res;						\
    2.69 +})
    2.70 +
    2.71 +#define _hypercall2(type, name, a1, a2)				\
    2.72 +({								\
    2.73 +	long __res, __ign1, __ign2;				\
    2.74 +	asm volatile (						\
    2.75 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    2.76 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2)	\
    2.77 +		: "1" ((long)(a1)), "2" ((long)(a2))		\
    2.78 +		: "memory" );					\
    2.79 +	(type)__res;						\
    2.80 +})
    2.81 +
    2.82 +#define _hypercall3(type, name, a1, a2, a3)			\
    2.83 +({								\
    2.84 +	long __res, __ign1, __ign2, __ign3;			\
    2.85 +	asm volatile (						\
    2.86 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
    2.87 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2), 	\
    2.88 +		"=d" (__ign3)					\
    2.89 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
    2.90 +		"3" ((long)(a3))				\
    2.91 +		: "memory" );					\
    2.92 +	(type)__res;						\
    2.93 +})
    2.94 +
    2.95 +#define _hypercall4(type, name, a1, a2, a3, a4)			\
    2.96 +({								\
    2.97 +	long __res, __ign1, __ign2, __ign3;			\
    2.98 +	asm volatile (						\
    2.99 +		"movq %7,%%r10; "				\
   2.100 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   2.101 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),	\
   2.102 +		"=d" (__ign3)					\
   2.103 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
   2.104 +		"3" ((long)(a3)), "g" ((long)(a4))		\
   2.105 +		: "memory", "r10" );				\
   2.106 +	(type)__res;						\
   2.107 +})
   2.108 +
   2.109 +#define _hypercall5(type, name, a1, a2, a3, a4, a5)		\
   2.110 +({								\
   2.111 +	long __res, __ign1, __ign2, __ign3;			\
   2.112 +	asm volatile (						\
   2.113 +		"movq %7,%%r10; movq %8,%%r8; "			\
   2.114 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   2.115 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),	\
   2.116 +		"=d" (__ign3)					\
   2.117 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
   2.118 +		"3" ((long)(a3)), "g" ((long)(a4)),		\
   2.119 +		"g" ((long)(a5))				\
   2.120 +		: "memory", "r10", "r8" );			\
   2.121 +	(type)__res;						\
   2.122 +})
   2.123 +
   2.124 +static inline int
   2.125 +HYPERVISOR_set_trap_table(
   2.126 +	trap_info_t *table)
   2.127 +{
   2.128 +	return _hypercall1(int, set_trap_table, table);
   2.129 +}
   2.130 +
   2.131 +static inline int
   2.132 +HYPERVISOR_mmu_update(
   2.133 +	mmu_update_t *req, int count, int *success_count, domid_t domid)
   2.134 +{
   2.135 +	return _hypercall4(int, mmu_update, req, count, success_count, domid);
   2.136 +}
   2.137 +
   2.138 +static inline int
   2.139 +HYPERVISOR_mmuext_op(
   2.140 +	struct mmuext_op *op, int count, int *success_count, domid_t domid)
   2.141 +{
   2.142 +	return _hypercall4(int, mmuext_op, op, count, success_count, domid);
   2.143 +}
   2.144 +
   2.145 +static inline int
   2.146 +HYPERVISOR_set_gdt(
   2.147 +	unsigned long *frame_list, int entries)
   2.148 +{
   2.149 +	return _hypercall2(int, set_gdt, frame_list, entries);
   2.150 +}
   2.151 +
   2.152 +static inline int
   2.153 +HYPERVISOR_stack_switch(
   2.154 +	unsigned long ss, unsigned long esp)
   2.155 +{
   2.156 +	return _hypercall2(int, stack_switch, ss, esp);
   2.157 +}
   2.158 +
   2.159 +static inline int
   2.160 +HYPERVISOR_set_callbacks(
   2.161 +	unsigned long event_address, unsigned long failsafe_address, 
   2.162 +	unsigned long syscall_address)
   2.163 +{
   2.164 +	return _hypercall3(int, set_callbacks,
   2.165 +			   event_address, failsafe_address, syscall_address);
   2.166 +}
   2.167 +
   2.168 +static inline int
   2.169 +HYPERVISOR_fpu_taskswitch(
   2.170 +	int set)
   2.171 +{
   2.172 +	return _hypercall1(int, fpu_taskswitch, set);
   2.173 +}
   2.174 +
   2.175 +static inline int
   2.176 +HYPERVISOR_sched_op(
   2.177 +	int cmd, unsigned long arg)
   2.178 +{
   2.179 +	return _hypercall2(int, sched_op, cmd, arg);
   2.180 +}
   2.181 +
   2.182 +static inline long
   2.183 +HYPERVISOR_set_timer_op(
   2.184 +	u64 timeout)
   2.185 +{
   2.186 +	return _hypercall1(long, set_timer_op, timeout);
   2.187 +}
   2.188 +
   2.189 +static inline int
   2.190 +HYPERVISOR_dom0_op(
   2.191 +	dom0_op_t *dom0_op)
   2.192 +{
   2.193 +	dom0_op->interface_version = DOM0_INTERFACE_VERSION;
   2.194 +	return _hypercall1(int, dom0_op, dom0_op);
   2.195 +}
   2.196 +
   2.197 +static inline int
   2.198 +HYPERVISOR_set_debugreg(
   2.199 +	int reg, unsigned long value)
   2.200 +{
   2.201 +	return _hypercall2(int, set_debugreg, reg, value);
   2.202 +}
   2.203 +
   2.204 +static inline unsigned long
   2.205 +HYPERVISOR_get_debugreg(
   2.206 +	int reg)
   2.207 +{
   2.208 +	return _hypercall1(unsigned long, get_debugreg, reg);
   2.209 +}
   2.210 +
   2.211 +static inline int
   2.212 +HYPERVISOR_update_descriptor(
   2.213 +	unsigned long ma, unsigned long word)
   2.214 +{
   2.215 +	return _hypercall2(int, update_descriptor, ma, word);
   2.216 +}
   2.217 +
   2.218 +static inline int
   2.219 +HYPERVISOR_memory_op(
   2.220 +	unsigned int cmd, void *arg)
   2.221 +{
   2.222 +	return _hypercall2(int, memory_op, cmd, arg);
   2.223 +}
   2.224 +
   2.225 +static inline int
   2.226 +HYPERVISOR_multicall(
   2.227 +	void *call_list, int nr_calls)
   2.228 +{
   2.229 +	return _hypercall2(int, multicall, call_list, nr_calls);
   2.230 +}
   2.231 +
   2.232 +static inline int
   2.233 +HYPERVISOR_update_va_mapping(
   2.234 +	unsigned long va, pte_t new_val, unsigned long flags)
   2.235 +{
   2.236 +	return _hypercall3(int, update_va_mapping, va, new_val.pte, flags);
   2.237 +}
   2.238 +
   2.239 +static inline int
   2.240 +HYPERVISOR_event_channel_op(
   2.241 +	void *op)
   2.242 +{
   2.243 +	return _hypercall1(int, event_channel_op, op);
   2.244 +}
   2.245 +
   2.246 +static inline int
   2.247 +HYPERVISOR_xen_version(
   2.248 +	int cmd, void *arg)
   2.249 +{
   2.250 +	return _hypercall2(int, xen_version, cmd, arg);
   2.251 +}
   2.252 +
   2.253 +static inline int
   2.254 +HYPERVISOR_console_io(
   2.255 +	int cmd, int count, char *str)
   2.256 +{
   2.257 +	return _hypercall3(int, console_io, cmd, count, str);
   2.258 +}
   2.259 +
   2.260 +static inline int
   2.261 +HYPERVISOR_physdev_op(
   2.262 +	void *physdev_op)
   2.263 +{
   2.264 +	return _hypercall1(int, physdev_op, physdev_op);
   2.265 +}
   2.266 +
   2.267 +static inline int
   2.268 +HYPERVISOR_grant_table_op(
   2.269 +	unsigned int cmd, void *uop, unsigned int count)
   2.270 +{
   2.271 +	return _hypercall3(int, grant_table_op, cmd, uop, count);
   2.272 +}
   2.273 +
   2.274 +static inline int
   2.275 +HYPERVISOR_update_va_mapping_otherdomain(
   2.276 +	unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
   2.277 +{
   2.278 +	return _hypercall4(int, update_va_mapping_otherdomain, va,
   2.279 +			   new_val.pte, flags, domid);
   2.280 +}
   2.281 +
   2.282 +static inline int
   2.283 +HYPERVISOR_vm_assist(
   2.284 +	unsigned int cmd, unsigned int type)
   2.285 +{
   2.286 +	return _hypercall2(int, vm_assist, cmd, type);
   2.287 +}
   2.288 +
   2.289 +static inline int
   2.290 +HYPERVISOR_vcpu_op(
   2.291 +	int cmd, int vcpuid, void *extra_args)
   2.292 +{
   2.293 +	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
   2.294 +}
   2.295 +
   2.296 +static inline int
   2.297 +HYPERVISOR_set_segment_base(
   2.298 +	int reg, unsigned long value)
   2.299 +{
   2.300 +	return _hypercall2(int, set_segment_base, reg, value);
   2.301 +}
   2.302 +
   2.303 +static inline int
   2.304 +HYPERVISOR_suspend(
   2.305 +	unsigned long srec)
   2.306 +{
   2.307 +	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
   2.308 +			   SHUTDOWN_suspend, srec);
   2.309 +}
   2.310 +
   2.311 +static inline int
   2.312 +HYPERVISOR_nmi_op(
   2.313 +	unsigned long op,
   2.314 +	unsigned long arg)
   2.315 +{
   2.316 +	return _hypercall2(int, nmi_op, op, arg);
   2.317 +}
   2.318 +
   2.319 +#endif /* __HYPERCALL_X86_64_H__ */
   2.320 +
   2.321 +/*
   2.322 + * Local variables:
   2.323 + *  c-file-style: "linux"
   2.324 + *  indent-tabs-mode: t
   2.325 + *  c-indent-level: 8
   2.326 + *  c-basic-offset: 8
   2.327 + *  tab-width: 8
   2.328 + * End:
   2.329 + */
     3.1 --- a/extras/mini-os/include/hypervisor.h	Thu Feb 23 11:24:37 2006 +0100
     3.2 +++ b/extras/mini-os/include/hypervisor.h	Thu Feb 23 11:27:35 2006 +0100
     3.3 @@ -3,10 +3,10 @@
     3.4   * 
     3.5   * Hypervisor handling.
     3.6   * 
     3.7 - * TODO - x86_64 broken!
     3.8   *
     3.9   * Copyright (c) 2002, K A Fraser
    3.10   * Copyright (c) 2005, Grzegorz Milos
    3.11 + * Updates: Aravindh Puthiyaparambil <aravindh.puthiyaparambil@unisys.com>
    3.12   */
    3.13  
    3.14  #ifndef _HYPERVISOR_H_
    3.15 @@ -15,6 +15,13 @@
    3.16  #include <types.h>
    3.17  #include <xen/xen.h>
    3.18  #include <xen/dom0_ops.h>
    3.19 +#if defined(__i386__)
    3.20 +#include <hypercall-x86_32.h>
    3.21 +#elif defined(__x86_64__)
    3.22 +#include <hypercall-x86_64.h>
    3.23 +#else
    3.24 +#error "Unsupported architecture"
    3.25 +#endif
    3.26  
    3.27  /*
    3.28   * a placeholder for the start of day information passed up from the hypervisor
    3.29 @@ -27,503 +34,10 @@ union start_info_union
    3.30  extern union start_info_union start_info_union;
    3.31  #define start_info (start_info_union.start_info)
    3.32  
    3.33 -
    3.34  /* hypervisor.c */
    3.35  //void do_hypervisor_callback(struct pt_regs *regs);
    3.36  void mask_evtchn(u32 port);
    3.37  void unmask_evtchn(u32 port);
    3.38  void clear_evtchn(u32 port);
    3.39  
    3.40 -/*
    3.41 - * Assembler stubs for hyper-calls.
    3.42 - */
    3.43 -#if defined(__i386__)
    3.44 -/* Taken from Linux */
    3.45 -
    3.46 -#ifndef __HYPERCALL_H__
    3.47 -#define __HYPERCALL_H__
    3.48 -
    3.49 -#include <xen/sched.h>
    3.50 -
    3.51 -#define _hypercall0(type, name)			\
    3.52 -({						\
    3.53 -	long __res;				\
    3.54 -	asm volatile (				\
    3.55 -		TRAP_INSTR			\
    3.56 -		: "=a" (__res)			\
    3.57 -		: "0" (__HYPERVISOR_##name)	\
    3.58 -		: "memory" );			\
    3.59 -	(type)__res;				\
    3.60 -})
    3.61 -
    3.62 -#define _hypercall1(type, name, a1)				\
    3.63 -({								\
    3.64 -	long __res, __ign1;					\
    3.65 -	asm volatile (						\
    3.66 -		TRAP_INSTR					\
    3.67 -		: "=a" (__res), "=b" (__ign1)			\
    3.68 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1))	\
    3.69 -		: "memory" );					\
    3.70 -	(type)__res;						\
    3.71 -})
    3.72 -
    3.73 -#define _hypercall2(type, name, a1, a2)				\
    3.74 -({								\
    3.75 -	long __res, __ign1, __ign2;				\
    3.76 -	asm volatile (						\
    3.77 -		TRAP_INSTR					\
    3.78 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2)	\
    3.79 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1)),	\
    3.80 -		"2" ((long)(a2))				\
    3.81 -		: "memory" );					\
    3.82 -	(type)__res;						\
    3.83 -})
    3.84 -
    3.85 -#define _hypercall3(type, name, a1, a2, a3)			\
    3.86 -({								\
    3.87 -	long __res, __ign1, __ign2, __ign3;			\
    3.88 -	asm volatile (						\
    3.89 -		TRAP_INSTR					\
    3.90 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2), 	\
    3.91 -		"=d" (__ign3)					\
    3.92 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1)),	\
    3.93 -		"2" ((long)(a2)), "3" ((long)(a3))		\
    3.94 -		: "memory" );					\
    3.95 -	(type)__res;						\
    3.96 -})
    3.97 -
    3.98 -#define _hypercall4(type, name, a1, a2, a3, a4)			\
    3.99 -({								\
   3.100 -	long __res, __ign1, __ign2, __ign3, __ign4;		\
   3.101 -	asm volatile (						\
   3.102 -		TRAP_INSTR					\
   3.103 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
   3.104 -		"=d" (__ign3), "=S" (__ign4)			\
   3.105 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1)),	\
   3.106 -		"2" ((long)(a2)), "3" ((long)(a3)),		\
   3.107 -		"4" ((long)(a4))				\
   3.108 -		: "memory" );					\
   3.109 -	(type)__res;						\
   3.110 -})
   3.111 -
   3.112 -#define _hypercall5(type, name, a1, a2, a3, a4, a5)		\
   3.113 -({								\
   3.114 -	long __res, __ign1, __ign2, __ign3, __ign4, __ign5;	\
   3.115 -	asm volatile (						\
   3.116 -		TRAP_INSTR					\
   3.117 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
   3.118 -		"=d" (__ign3), "=S" (__ign4), "=D" (__ign5)	\
   3.119 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1)),	\
   3.120 -		"2" ((long)(a2)), "3" ((long)(a3)),		\
   3.121 -		"4" ((long)(a4)), "5" ((long)(a5))		\
   3.122 -		: "memory" );					\
   3.123 -	(type)__res;						\
   3.124 -})
   3.125 -
   3.126 -static inline int
   3.127 -HYPERVISOR_set_trap_table(
   3.128 -	trap_info_t *table)
   3.129 -{
   3.130 -	return _hypercall1(int, set_trap_table, table);
   3.131 -}
   3.132 -
   3.133 -static inline int
   3.134 -HYPERVISOR_mmu_update(
   3.135 -	mmu_update_t *req, int count, int *success_count, domid_t domid)
   3.136 -{
   3.137 -	return _hypercall4(int, mmu_update, req, count, success_count, domid);
   3.138 -}
   3.139 -
   3.140 -static inline int
   3.141 -HYPERVISOR_mmuext_op(
   3.142 -	struct mmuext_op *op, int count, int *success_count, domid_t domid)
   3.143 -{
   3.144 -	return _hypercall4(int, mmuext_op, op, count, success_count, domid);
   3.145 -}
   3.146 -
   3.147 -static inline int
   3.148 -HYPERVISOR_set_gdt(
   3.149 -	unsigned long *frame_list, int entries)
   3.150 -{
   3.151 -	return _hypercall2(int, set_gdt, frame_list, entries);
   3.152 -}
   3.153 -
   3.154 -static inline int
   3.155 -HYPERVISOR_stack_switch(
   3.156 -	unsigned long ss, unsigned long esp)
   3.157 -{
   3.158 -	return _hypercall2(int, stack_switch, ss, esp);
   3.159 -}
   3.160 -
   3.161 -static inline int
   3.162 -HYPERVISOR_set_callbacks(
   3.163 -	unsigned long event_selector, unsigned long event_address,
   3.164 -	unsigned long failsafe_selector, unsigned long failsafe_address)
   3.165 -{
   3.166 -	return _hypercall4(int, set_callbacks,
   3.167 -			   event_selector, event_address,
   3.168 -			   failsafe_selector, failsafe_address);
   3.169 -}
   3.170 -
   3.171 -static inline int
   3.172 -HYPERVISOR_fpu_taskswitch(
   3.173 -	int set)
   3.174 -{
   3.175 -	return _hypercall1(int, fpu_taskswitch, set);
   3.176 -}
   3.177 -
   3.178 -static inline int
   3.179 -HYPERVISOR_sched_op(
   3.180 -	int cmd, unsigned long arg)
   3.181 -{
   3.182 -	return _hypercall2(int, sched_op, cmd, arg);
   3.183 -}
   3.184 -
   3.185 -static inline long
   3.186 -HYPERVISOR_set_timer_op(
   3.187 -	u64 timeout)
   3.188 -{
   3.189 -	unsigned long timeout_hi = (unsigned long)(timeout>>32);
   3.190 -	unsigned long timeout_lo = (unsigned long)timeout;
   3.191 -	return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
   3.192 -}
   3.193 -
   3.194 -static inline int
   3.195 -HYPERVISOR_dom0_op(
   3.196 -	dom0_op_t *dom0_op)
   3.197 -{
   3.198 -	dom0_op->interface_version = DOM0_INTERFACE_VERSION;
   3.199 -	return _hypercall1(int, dom0_op, dom0_op);
   3.200 -}
   3.201 -
   3.202 -static inline int
   3.203 -HYPERVISOR_set_debugreg(
   3.204 -	int reg, unsigned long value)
   3.205 -{
   3.206 -	return _hypercall2(int, set_debugreg, reg, value);
   3.207 -}
   3.208 -
   3.209 -static inline unsigned long
   3.210 -HYPERVISOR_get_debugreg(
   3.211 -	int reg)
   3.212 -{
   3.213 -	return _hypercall1(unsigned long, get_debugreg, reg);
   3.214 -}
   3.215 -
   3.216 -static inline int
   3.217 -HYPERVISOR_update_descriptor(
   3.218 -	u64 ma, u64 desc)
   3.219 -{
   3.220 -	return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
   3.221 -}
   3.222 -
   3.223 -static inline int
   3.224 -HYPERVISOR_memory_op(
   3.225 -	unsigned int cmd, void *arg)
   3.226 -{
   3.227 -	return _hypercall2(int, memory_op, cmd, arg);
   3.228 -}
   3.229 -
   3.230 -static inline int
   3.231 -HYPERVISOR_multicall(
   3.232 -	void *call_list, int nr_calls)
   3.233 -{
   3.234 -	return _hypercall2(int, multicall, call_list, nr_calls);
   3.235 -}
   3.236 -
   3.237 -static inline int
   3.238 -HYPERVISOR_update_va_mapping(
   3.239 -	unsigned long va, pte_t new_val, unsigned long flags)
   3.240 -{
   3.241 -	unsigned long pte_hi = 0;
   3.242 -#ifdef CONFIG_X86_PAE
   3.243 -	pte_hi = new_val.pte_high;
   3.244 -#endif
   3.245 -	return _hypercall4(int, update_va_mapping, va,
   3.246 -			   new_val.pte_low, pte_hi, flags);
   3.247 -}
   3.248 -
   3.249 -static inline int
   3.250 -HYPERVISOR_event_channel_op(
   3.251 -	void *op)
   3.252 -{
   3.253 -	return _hypercall1(int, event_channel_op, op);
   3.254 -}
   3.255 -
   3.256 -static inline int
   3.257 -HYPERVISOR_xen_version(
   3.258 -	int cmd, void *arg)
   3.259 -{
   3.260 -	return _hypercall2(int, xen_version, cmd, arg);
   3.261 -}
   3.262 -
   3.263 -static inline int
   3.264 -HYPERVISOR_console_io(
   3.265 -	int cmd, int count, char *str)
   3.266 -{
   3.267 -	return _hypercall3(int, console_io, cmd, count, str);
   3.268 -}
   3.269 -
   3.270 -static inline int
   3.271 -HYPERVISOR_physdev_op(
   3.272 -	void *physdev_op)
   3.273 -{
   3.274 -	return _hypercall1(int, physdev_op, physdev_op);
   3.275 -}
   3.276 -
   3.277 -static inline int
   3.278 -HYPERVISOR_grant_table_op(
   3.279 -	unsigned int cmd, void *uop, unsigned int count)
   3.280 -{
   3.281 -	return _hypercall3(int, grant_table_op, cmd, uop, count);
   3.282 -}
   3.283 -
   3.284 -static inline int
   3.285 -HYPERVISOR_update_va_mapping_otherdomain(
   3.286 -	unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
   3.287 -{
   3.288 -	unsigned long pte_hi = 0;
   3.289 -#ifdef CONFIG_X86_PAE
   3.290 -	pte_hi = new_val.pte_high;
   3.291 -#endif
   3.292 -	return _hypercall5(int, update_va_mapping_otherdomain, va,
   3.293 -			   new_val.pte_low, pte_hi, flags, domid);
   3.294 -}
   3.295 -
   3.296 -static inline int
   3.297 -HYPERVISOR_vm_assist(
   3.298 -	unsigned int cmd, unsigned int type)
   3.299 -{
   3.300 -	return _hypercall2(int, vm_assist, cmd, type);
   3.301 -}
   3.302 -
   3.303 -static inline int
   3.304 -HYPERVISOR_vcpu_op(
   3.305 -	int cmd, int vcpuid, void *extra_args)
   3.306 -{
   3.307 -	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
   3.308 -}
   3.309 -
   3.310 -static inline int
   3.311 -HYPERVISOR_suspend(
   3.312 -	unsigned long srec)
   3.313 -{
   3.314 -	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
   3.315 -			   SHUTDOWN_suspend, srec);
   3.316 -}
   3.317 -
   3.318 -#endif /* __HYPERCALL_H__ */
   3.319 -#elif defined(__x86_64__)
   3.320 -
   3.321 -#define __syscall_clobber "r11","rcx","memory"
   3.322 -
   3.323 -/*
   3.324 - * Assembler stubs for hyper-calls.
   3.325 - */
   3.326 -static inline int
   3.327 -HYPERVISOR_set_trap_table(
   3.328 -    trap_info_t *table)
   3.329 -{
   3.330 -    int ret;
   3.331 -
   3.332 -    __asm__ __volatile__ (
   3.333 -        TRAP_INSTR
   3.334 -        : "=a" (ret)
   3.335 -	: "0" ((unsigned long)__HYPERVISOR_set_trap_table), "D" (table)
   3.336 -	: __syscall_clobber );
   3.337 -
   3.338 -    return ret;
   3.339 -}
   3.340 -
   3.341 -static inline int
   3.342 -HYPERVISOR_mmu_update(
   3.343 -    mmu_update_t *req, int count, int *success_count, domid_t domid)
   3.344 -{
   3.345 -    int ret;
   3.346 -
   3.347 -    __asm__ __volatile__ (
   3.348 -        "movq %5, %%r10;" TRAP_INSTR
   3.349 -        : "=a" (ret)
   3.350 -	: "0" ((unsigned long)__HYPERVISOR_mmu_update), "D" (req), "S" ((long)count),
   3.351 -	  "d" (success_count), "g" ((unsigned long)domid)
   3.352 -	: __syscall_clobber, "r10" );
   3.353 -
   3.354 -    return ret;
   3.355 -}
   3.356 -
   3.357 -static inline int
   3.358 -HYPERVISOR_mmuext_op(
   3.359 -    struct mmuext_op *op, int count, int *success_count, domid_t domid)
   3.360 -{
   3.361 -    int ret;
   3.362 -
   3.363 -    __asm__ __volatile__ (
   3.364 -        "movq %5, %%r10;" TRAP_INSTR
   3.365 -        : "=a" (ret)
   3.366 -        : "0" (__HYPERVISOR_mmuext_op), "D" (op), "S" ((long)count), 
   3.367 -          "d" (success_count), "g" ((unsigned long)domid)
   3.368 -        : __syscall_clobber, "r10" );
   3.369 -
   3.370 -    return ret;
   3.371 -}
   3.372 -
   3.373 -static inline int
   3.374 -HYPERVISOR_set_gdt(
   3.375 -    unsigned long *frame_list, int entries)
   3.376 -{
   3.377 -    int ret;
   3.378 -
   3.379 -    __asm__ __volatile__ (
   3.380 -        TRAP_INSTR
   3.381 -        : "=a" (ret)
   3.382 -	: "0" ((unsigned long)__HYPERVISOR_set_gdt), "D" (frame_list), "S" ((long)entries)
   3.383 -	: __syscall_clobber );
   3.384 -
   3.385 -
   3.386 -    return ret;
   3.387 -}
   3.388 -static inline int
   3.389 -HYPERVISOR_stack_switch(
   3.390 -    unsigned long ss, unsigned long esp)
   3.391 -{
   3.392 -    int ret;
   3.393 -
   3.394 -    __asm__ __volatile__ (
   3.395 -        TRAP_INSTR
   3.396 -        : "=a" (ret)
   3.397 -	: "0" ((unsigned long)__HYPERVISOR_stack_switch), "D" (ss), "S" (esp)
   3.398 -	: __syscall_clobber );
   3.399 -
   3.400 -    return ret;
   3.401 -}
   3.402 -
   3.403 -static inline int
   3.404 -HYPERVISOR_set_callbacks(
   3.405 -    unsigned long event_address, unsigned long failsafe_address, 
   3.406 -    unsigned long syscall_address)
   3.407 -{
   3.408 -    int ret;
   3.409 -
   3.410 -    __asm__ __volatile__ (
   3.411 -        TRAP_INSTR
   3.412 -        : "=a" (ret)
   3.413 -	: "0" ((unsigned long)__HYPERVISOR_set_callbacks), "D" (event_address),
   3.414 -	  "S" (failsafe_address), "d" (syscall_address)
   3.415 -	: __syscall_clobber );
   3.416 -
   3.417 -    return ret;
   3.418 -}
   3.419 -
   3.420 -static inline int
   3.421 -HYPERVISOR_fpu_taskswitch(
   3.422 -    int set)
   3.423 -{
   3.424 -    int ret;
   3.425 -    __asm__ __volatile__ (
   3.426 -        TRAP_INSTR
   3.427 -        : "=a" (ret) : "0" ((unsigned long)__HYPERVISOR_fpu_taskswitch),
   3.428 -          "D" ((unsigned long) set) : __syscall_clobber );
   3.429 -
   3.430 -    return ret;
   3.431 -}
   3.432 -
   3.433 -static inline int
   3.434 -HYPERVISOR_yield(
   3.435 -    void)
   3.436 -{
   3.437 -    int ret;
   3.438 -
   3.439 -    __asm__ __volatile__ (
   3.440 -        TRAP_INSTR
   3.441 -        : "=a" (ret)
   3.442 -	: "0" ((unsigned long)__HYPERVISOR_sched_op), "D" ((unsigned long)SCHEDOP_yield)
   3.443 -	: __syscall_clobber );
   3.444 -
   3.445 -    return ret;
   3.446 -}
   3.447 -
   3.448 -static inline int
   3.449 -HYPERVISOR_block(
   3.450 -    void)
   3.451 -{
   3.452 -    int ret;
   3.453 -    __asm__ __volatile__ (
   3.454 -        TRAP_INSTR
   3.455 -        : "=a" (ret)
   3.456 -	: "0" ((unsigned long)__HYPERVISOR_sched_op), "D" ((unsigned long)SCHEDOP_block)
   3.457 -	: __syscall_clobber );
   3.458 -
   3.459 -    return ret;
   3.460 -}
   3.461 -
   3.462 -static inline int
   3.463 -HYPERVISOR_shutdown(
   3.464 -    void)
   3.465 -{
   3.466 -    int ret;
   3.467 -    __asm__ __volatile__ (
   3.468 -        TRAP_INSTR
   3.469 -        : "=a" (ret)
   3.470 -	: "0" ((unsigned long)__HYPERVISOR_sched_op),
   3.471 -	  "D" ((unsigned long)(SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift)))
   3.472 -	: __syscall_clobber );
   3.473 -
   3.474 -    return ret;
   3.475 -}
   3.476 -
   3.477 -static inline int
   3.478 -HYPERVISOR_reboot(
   3.479 -    void)
   3.480 -{
   3.481 -    int ret;
   3.482 -
   3.483 -    __asm__ __volatile__ (
   3.484 -        TRAP_INSTR
   3.485 -        : "=a" (ret)
   3.486 -	: "0" ((unsigned long)__HYPERVISOR_sched_op),
   3.487 -	  "D" ((unsigned long)(SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift)))
   3.488 -	: __syscall_clobber );
   3.489 -
   3.490 -    return ret;
   3.491 -}
   3.492 -
   3.493 -static inline int
   3.494 -HYPERVISOR_suspend(
   3.495 -    unsigned long srec)
   3.496 -{
   3.497 -    int ret;
   3.498 -
   3.499 -    /* NB. On suspend, control software expects a suspend record in %esi. */
   3.500 -    __asm__ __volatile__ (
   3.501 -        TRAP_INSTR
   3.502 -        : "=a" (ret)
   3.503 -	: "0" ((unsigned long)__HYPERVISOR_sched_op),
   3.504 -        "D" ((unsigned long)(SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift))), 
   3.505 -        "S" (srec)
   3.506 -	: __syscall_clobber );
   3.507 -
   3.508 -    return ret;
   3.509 -}
   3.510 -
   3.511 -/*
   3.512 - * We can have the timeout value in a single argument for the hypercall, but
   3.513 - * that will break the common code. 
   3.514 - */
   3.515 -static inline long
   3.516 -HYPERVISOR_set_timer_op(
   3.517 -    u64 timeout)
   3.518 -{
   3.519 -    int ret;
   3.520 -
   3.521 -    __asm__ __volatile__ (
   3.522 -        TRAP_INSTR
   3.523 -        : "=a" (ret)
   3.524 -	: "0" ((unsigned long)__HYPERVISOR_set_timer_op),
   3.525 -	  "D" (timeout)
   3.526 -	: __syscall_clobber );
   3.527 -
   3.528 -    return ret;
   3.529 -}
   3.530 -#endif
   3.531 -
   3.532  #endif /* __HYPERVISOR_H__ */
     4.1 --- a/extras/mini-os/x86_32.S	Thu Feb 23 11:24:37 2006 +0100
     4.2 +++ b/extras/mini-os/x86_32.S	Thu Feb 23 11:27:35 2006 +0100
     4.3 @@ -1,16 +1,16 @@
     4.4  #include <os.h>
     4.5  #include <xen/arch-x86_32.h>
     4.6  
     4.7 -
     4.8  .section __xen_guest
     4.9  	.ascii	"GUEST_OS=Mini-OS"
    4.10  	.ascii	",XEN_VER=xen-3.0"
    4.11 +	.ascii	",HYPERCALL_PAGE=0x2"
    4.12  	.ascii	",LOADER=generic"
    4.13  	.ascii	",PT_MODE_WRITABLE"
    4.14  	.byte	0
    4.15  .text
    4.16  
    4.17 -.globl _start, shared_info
    4.18 +.globl _start, shared_info, hypercall_page
    4.19                          
    4.20  _start:
    4.21          cld
    4.22 @@ -26,7 +26,9 @@ stack_start:
    4.23          .org 0x1000
    4.24  shared_info:
    4.25          .org 0x2000
    4.26 -        
    4.27 +
    4.28 +hypercall_page:
    4.29 +        .org 0x3000
    4.30  
    4.31  ES		= 0x20
    4.32  ORIG_EAX	= 0x24
     5.1 --- a/extras/mini-os/x86_64.S	Thu Feb 23 11:24:37 2006 +0100
     5.2 +++ b/extras/mini-os/x86_64.S	Thu Feb 23 11:27:35 2006 +0100
     5.3 @@ -1,11 +1,16 @@
     5.4  #include <os.h>
     5.5  
     5.6  .section __xen_guest
     5.7 -        .asciz  "XEN_VER=3.0,LOADER=generic,PT_MODE_WRITABLE"
     5.8 +	.ascii	"GUEST_OS=Mini-OS"
     5.9 +	.ascii	",XEN_VER=xen-3.0"
    5.10 +	.ascii	",HYPERCALL_PAGE=0x2"
    5.11 +	.ascii	",LOADER=generic"
    5.12 +	.ascii	",PT_MODE_WRITABLE"
    5.13 +	.byte	0
    5.14  .text
    5.15  
    5.16  #define ENTRY(X) .globl X ; X :
    5.17 -.globl _start, shared_info
    5.18 +.globl _start, shared_info, hypercall_page
    5.19  
    5.20  #define SAVE_ALL \
    5.21          cld; \
    5.22 @@ -57,6 +62,9 @@ stack_start:
    5.23  shared_info:
    5.24          .org 0x2000
    5.25  
    5.26 +hypercall_page:
    5.27 +        .org 0x3000
    5.28 +
    5.29  ENTRY(hypervisor_callback)
    5.30          popq  %rcx
    5.31          popq  %r11