Home | History | Annotate | Line # | Download | only in include
hypervisor.h revision 1.14.2.2
      1  1.14.2.2    yamt /*	$NetBSD: hypervisor.h,v 1.14.2.2 2006/12/30 20:47:25 yamt Exp $	*/
      2  1.14.2.1    yamt 
      3  1.14.2.1    yamt /*
      4  1.14.2.1    yamt  * Copyright (c) 2006 Manuel Bouyer.
      5  1.14.2.1    yamt  *
      6  1.14.2.1    yamt  * Redistribution and use in source and binary forms, with or without
      7  1.14.2.1    yamt  * modification, are permitted provided that the following conditions
      8  1.14.2.1    yamt  * are met:
      9  1.14.2.1    yamt  * 1. Redistributions of source code must retain the above copyright
     10  1.14.2.1    yamt  *    notice, this list of conditions and the following disclaimer.
     11  1.14.2.1    yamt  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.14.2.1    yamt  *    notice, this list of conditions and the following disclaimer in the
     13  1.14.2.1    yamt  *    documentation and/or other materials provided with the distribution.
     14  1.14.2.1    yamt  * 3. All advertising materials mentioning features or use of this software
     15  1.14.2.1    yamt  *    must display the following acknowledgement:
     16  1.14.2.1    yamt  *	This product includes software developed by Manuel Bouyer.
     17  1.14.2.1    yamt  * 4. The name of the author may not be used to endorse or promote products
     18  1.14.2.1    yamt  *    derived from this software without specific prior written permission.
     19  1.14.2.1    yamt  *
     20  1.14.2.1    yamt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  1.14.2.1    yamt  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  1.14.2.1    yamt  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  1.14.2.1    yamt  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  1.14.2.1    yamt  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  1.14.2.1    yamt  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  1.14.2.1    yamt  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  1.14.2.1    yamt  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  1.14.2.1    yamt  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  1.14.2.1    yamt  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  1.14.2.1    yamt  *
     31  1.14.2.1    yamt  */
     32       1.1      cl 
     33       1.1      cl /*
     34       1.1      cl  *
     35       1.1      cl  * Communication to/from hypervisor.
     36       1.1      cl  *
     37      1.10  bouyer  * Copyright (c) 2002-2004, K A Fraser
     38       1.1      cl  *
     39       1.1      cl  * Permission is hereby granted, free of charge, to any person obtaining a copy
     40      1.10  bouyer  * of this source file (the "Software"), to deal in the Software without
     41      1.10  bouyer  * restriction, including without limitation the rights to use, copy, modify,
     42      1.10  bouyer  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
     43      1.10  bouyer  * and to permit persons to whom the Software is furnished to do so, subject to
     44      1.10  bouyer  * the following conditions:
     45       1.1      cl  *
     46       1.1      cl  * The above copyright notice and this permission notice shall be included in
     47       1.1      cl  * all copies or substantial portions of the Software.
     48       1.1      cl  *
     49      1.10  bouyer  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     50      1.10  bouyer  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     51      1.10  bouyer  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     52      1.10  bouyer  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     53      1.10  bouyer  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     54      1.10  bouyer  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     55      1.10  bouyer  * IN THE SOFTWARE.
     56       1.1      cl  */
     57       1.1      cl 
     58       1.1      cl 
     59       1.1      cl #ifndef _XEN_HYPERVISOR_H_
     60       1.1      cl #define _XEN_HYPERVISOR_H_
     61       1.1      cl 
     62  1.14.2.1    yamt #include "opt_xen.h"
     63  1.14.2.1    yamt 
     64       1.1      cl 
     65       1.4      cl struct hypervisor_attach_args {
     66       1.4      cl 	const char 		*haa_busname;
     67       1.4      cl };
     68       1.4      cl 
     69       1.5      cl struct xencons_attach_args {
     70       1.4      cl 	const char 		*xa_device;
     71       1.1      cl };
     72       1.1      cl 
     73       1.1      cl struct xen_npx_attach_args {
     74       1.4      cl 	const char 		*xa_device;
     75       1.1      cl };
     76       1.1      cl 
     77       1.1      cl 
     78      1.10  bouyer #define	u8 uint8_t
     79       1.8      cl #define	u16 uint16_t
     80       1.8      cl #define	u32 uint32_t
     81       1.8      cl #define	u64 uint64_t
     82      1.10  bouyer #define	s8 int8_t
     83      1.10  bouyer #define	s16 int16_t
     84      1.10  bouyer #define	s32 int32_t
     85      1.10  bouyer #define	s64 int64_t
     86      1.10  bouyer 
     87  1.14.2.1    yamt #ifdef XEN3
     88  1.14.2.1    yamt #include <machine/xen3-public/xen.h>
     89  1.14.2.1    yamt #include <machine/xen3-public/sched.h>
     90  1.14.2.1    yamt #include <machine/xen3-public/dom0_ops.h>
     91  1.14.2.1    yamt #include <machine/xen3-public/event_channel.h>
     92  1.14.2.1    yamt #include <machine/xen3-public/physdev.h>
     93  1.14.2.1    yamt #include <machine/xen3-public/memory.h>
     94  1.14.2.1    yamt #include <machine/xen3-public/io/netif.h>
     95  1.14.2.1    yamt #include <machine/xen3-public/io/blkif.h>
     96  1.14.2.1    yamt #else
     97      1.10  bouyer #include <machine/xen-public/xen.h>
     98      1.10  bouyer #include <machine/xen-public/dom0_ops.h>
     99      1.10  bouyer #include <machine/xen-public/event_channel.h>
    100      1.10  bouyer #include <machine/xen-public/physdev.h>
    101      1.10  bouyer #include <machine/xen-public/io/domain_controller.h>
    102      1.10  bouyer #include <machine/xen-public/io/netif.h>
    103      1.10  bouyer #include <machine/xen-public/io/blkif.h>
    104  1.14.2.1    yamt #endif
    105       1.8      cl 
    106      1.10  bouyer #undef u8
    107       1.8      cl #undef u16
    108       1.8      cl #undef u32
    109       1.8      cl #undef u64
    110      1.10  bouyer #undef s8
    111      1.10  bouyer #undef s16
    112      1.10  bouyer #undef s32
    113      1.10  bouyer #undef s64
    114       1.1      cl 
    115       1.1      cl 
    116       1.1      cl /*
    117       1.1      cl  * a placeholder for the start of day information passed up from the hypervisor
    118       1.1      cl  */
    119       1.1      cl union start_info_union
    120       1.1      cl {
    121       1.1      cl     start_info_t start_info;
    122       1.1      cl     char padding[512];
    123       1.1      cl };
    124       1.1      cl extern union start_info_union start_info_union;
    125       1.1      cl #define xen_start_info (start_info_union.start_info)
    126       1.1      cl 
    127  1.14.2.1    yamt /* For use in guest OSes. */
    128  1.14.2.1    yamt volatile extern shared_info_t *HYPERVISOR_shared_info;
    129       1.1      cl 
    130       1.1      cl /* hypervisor.c */
    131      1.10  bouyer struct intrframe;
    132      1.10  bouyer void do_hypervisor_callback(struct intrframe *regs);
    133      1.11  bouyer void hypervisor_enable_event(unsigned int);
    134      1.10  bouyer 
    135      1.10  bouyer /* hypervisor_machdep.c */
    136      1.10  bouyer void hypervisor_unmask_event(unsigned int);
    137      1.10  bouyer void hypervisor_mask_event(unsigned int);
    138      1.10  bouyer void hypervisor_clear_event(unsigned int);
    139      1.12  bouyer void hypervisor_enable_ipl(unsigned int);
    140      1.13  bouyer void hypervisor_set_ipending(u_int32_t, int, int);
    141       1.1      cl 
    142       1.1      cl /*
    143       1.1      cl  * Assembler stubs for hyper-calls.
    144       1.1      cl  */
    145       1.1      cl 
    146  1.14.2.2    yamt #if defined(XEN3) && !defined(XEN_COMPAT_030001)
    147  1.14.2.2    yamt /* hypercall via the hypercall call page */
    148  1.14.2.2    yamt #define __str(x) #x
    149  1.14.2.2    yamt #define _str(x) __str(x)
    150  1.14.2.2    yamt #define _hypercall(name, input_const, output_const) \
    151  1.14.2.2    yamt 	__asm volatile ( \
    152  1.14.2.2    yamt 	    "call hypercall_page + ("_str(name)" * 32)" \
    153  1.14.2.2    yamt 	    : output_const \
    154  1.14.2.2    yamt 	    : input_const \
    155  1.14.2.2    yamt 	    : "memory" )
    156  1.14.2.2    yamt #else
    157  1.14.2.2    yamt /* traditionnal hypercall via int 0x82 */
    158  1.14.2.2    yamt #define _hypercall(name, input_const, output_const) \
    159  1.14.2.2    yamt 	__asm volatile ( \
    160  1.14.2.2    yamt 	    TRAP_INSTR \
    161  1.14.2.2    yamt 	    : output_const \
    162  1.14.2.2    yamt 	    : "0" (name), input_const \
    163  1.14.2.2    yamt 	    : "memory" )
    164  1.14.2.2    yamt #endif
    165  1.14.2.2    yamt 
    166  1.14.2.2    yamt #define _harg(...) __VA_ARGS__
    167  1.14.2.2    yamt 
    168  1.14.2.2    yamt 
    169  1.14.2.1    yamt static __inline int
    170      1.10  bouyer HYPERVISOR_set_trap_table(trap_info_t *table)
    171       1.1      cl {
    172       1.1      cl     int ret;
    173      1.10  bouyer     unsigned long ign1;
    174      1.10  bouyer 
    175  1.14.2.2    yamt 	_hypercall(__HYPERVISOR_set_trap_table, _harg("1" (table)),
    176  1.14.2.2    yamt 	    _harg("=a" (ret), "=b" (ign1)));
    177       1.1      cl 
    178       1.1      cl     return ret;
    179       1.1      cl }
    180       1.1      cl 
    181  1.14.2.1    yamt static __inline int
    182      1.10  bouyer HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
    183      1.10  bouyer {
    184      1.10  bouyer     int ret;
    185      1.10  bouyer     unsigned long ign1, ign2;
    186      1.10  bouyer 
    187  1.14.2.2    yamt     _hypercall(__HYPERVISOR_set_gdt, _harg("1" (frame_list), "2" (entries)),
    188  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    189       1.2      cl 
    190       1.1      cl     return ret;
    191       1.1      cl }
    192       1.1      cl 
    193  1.14.2.1    yamt static __inline int
    194      1.10  bouyer HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
    195       1.7      cl {
    196       1.7      cl     int ret;
    197      1.10  bouyer     unsigned long ign1, ign2;
    198      1.10  bouyer 
    199  1.14.2.2    yamt     _hypercall(__HYPERVISOR_stack_switch, _harg("1" (ss), "2" (esp)),
    200  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    201       1.7      cl 
    202       1.7      cl     return ret;
    203       1.7      cl }
    204       1.7      cl 
    205  1.14.2.1    yamt static __inline int
    206      1.10  bouyer HYPERVISOR_set_callbacks(
    207      1.10  bouyer     unsigned long event_selector, unsigned long event_address,
    208      1.10  bouyer     unsigned long failsafe_selector, unsigned long failsafe_address)
    209       1.1      cl {
    210       1.1      cl     int ret;
    211      1.10  bouyer     unsigned long ign1, ign2, ign3, ign4;
    212      1.10  bouyer 
    213  1.14.2.2    yamt     _hypercall(__HYPERVISOR_set_callbacks,
    214  1.14.2.2    yamt 	_harg("1" (event_selector),"2" (event_address),
    215  1.14.2.2    yamt 	    "3" (failsafe_selector), "4" (failsafe_address)),
    216  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));
    217       1.1      cl 
    218      1.10  bouyer     return ret;
    219      1.10  bouyer }
    220      1.10  bouyer 
    221  1.14.2.1    yamt static __inline int
    222  1.14.2.1    yamt HYPERVISOR_dom0_op(dom0_op_t *dom0_op)
    223      1.10  bouyer {
    224      1.10  bouyer     int ret;
    225  1.14.2.1    yamt     unsigned long ign1;
    226  1.14.2.1    yamt 
    227  1.14.2.1    yamt     dom0_op->interface_version = DOM0_INTERFACE_VERSION;
    228  1.14.2.2    yamt     _hypercall(__HYPERVISOR_dom0_op, _harg("1" (dom0_op)),
    229  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1)));
    230       1.1      cl 
    231       1.1      cl     return ret;
    232       1.1      cl }
    233       1.1      cl 
    234  1.14.2.1    yamt static __inline int
    235  1.14.2.1    yamt HYPERVISOR_set_debugreg(int reg, unsigned long value)
    236       1.1      cl {
    237       1.1      cl     int ret;
    238  1.14.2.1    yamt     unsigned long ign1, ign2;
    239  1.14.2.1    yamt 
    240  1.14.2.2    yamt     _hypercall(__HYPERVISOR_set_debugreg, _harg("1" (reg), "2" (value)),
    241  1.14.2.2    yamt 	 _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    242  1.14.2.1    yamt 
    243  1.14.2.1    yamt     return ret;
    244  1.14.2.1    yamt }
    245  1.14.2.1    yamt 
    246  1.14.2.1    yamt static __inline unsigned long
    247  1.14.2.1    yamt HYPERVISOR_get_debugreg(int reg)
    248  1.14.2.1    yamt {
    249  1.14.2.1    yamt     unsigned long ret;
    250      1.10  bouyer     unsigned long ign1;
    251      1.10  bouyer 
    252  1.14.2.2    yamt     _hypercall(__HYPERVISOR_get_debugreg, _harg("1" (reg)),
    253  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1)));
    254      1.10  bouyer 
    255      1.10  bouyer     return ret;
    256      1.10  bouyer }
    257      1.10  bouyer 
    258  1.14.2.1    yamt #ifdef XEN3
    259  1.14.2.1    yamt static __inline int
    260  1.14.2.1    yamt HYPERVISOR_mmu_update(mmu_update_t *req, int count, int *success_count,
    261  1.14.2.1    yamt     domid_t domid)
    262      1.10  bouyer {
    263      1.10  bouyer     int ret;
    264  1.14.2.1    yamt     unsigned long ign1, ign2, ign3, ign4;
    265       1.1      cl 
    266  1.14.2.2    yamt     _hypercall(__HYPERVISOR_mmu_update,
    267  1.14.2.2    yamt 	_harg("1" (req), "2" (count), "3" (success_count), "4" (domid)),
    268  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));
    269       1.1      cl 
    270       1.1      cl     return ret;
    271       1.1      cl }
    272       1.1      cl 
    273  1.14.2.1    yamt static __inline int
    274  1.14.2.1    yamt HYPERVISOR_mmuext_op(struct mmuext_op *op, int count, int *success_count,
    275  1.14.2.1    yamt     domid_t domid)
    276       1.1      cl {
    277       1.1      cl     int ret;
    278  1.14.2.1    yamt     unsigned long ign1, ign2, ign3, ign4;
    279      1.10  bouyer 
    280  1.14.2.2    yamt     _hypercall(__HYPERVISOR_mmuext_op,
    281  1.14.2.2    yamt 	_harg("1" (op), "2" (count), "3" (success_count), "4" (domid)),
    282  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));
    283  1.14.2.1    yamt 
    284  1.14.2.1    yamt     return ret;
    285  1.14.2.1    yamt }
    286  1.14.2.1    yamt 
    287  1.14.2.1    yamt #if 0
    288  1.14.2.1    yamt static __inline int
    289  1.14.2.1    yamt HYPERVISOR_fpu_taskswitch(int set)
    290  1.14.2.1    yamt {
    291  1.14.2.1    yamt     long ret;
    292  1.14.2.1    yamt     long ign1;
    293  1.14.2.2    yamt 
    294  1.14.2.2    yamt     _hypercall(__HYPERVISOR_fpu_taskswitch, _harg("1" (set)),
    295  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1)));
    296  1.14.2.1    yamt 
    297  1.14.2.1    yamt     return ret;
    298  1.14.2.1    yamt }
    299  1.14.2.1    yamt #else /* 0 */
    300  1.14.2.1    yamt /* Xen2 compat: always i38HYPERVISOR_fpu_taskswitch(1) */
    301  1.14.2.1    yamt static __inline int
    302  1.14.2.1    yamt HYPERVISOR_fpu_taskswitch(void)
    303  1.14.2.1    yamt {
    304  1.14.2.1    yamt     long ret;
    305  1.14.2.1    yamt     long ign1;
    306  1.14.2.2    yamt     _hypercall(__HYPERVISOR_fpu_taskswitch, _harg("1" (1)),
    307  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1)));
    308  1.14.2.1    yamt 
    309  1.14.2.1    yamt     return ret;
    310  1.14.2.1    yamt }
    311  1.14.2.1    yamt #endif /* 0 */
    312  1.14.2.1    yamt 
    313  1.14.2.1    yamt static __inline int
    314  1.14.2.1    yamt HYPERVISOR_update_descriptor(uint64_t ma, uint32_t word1, uint32_t word2)
    315  1.14.2.1    yamt {
    316  1.14.2.1    yamt     int ret;
    317  1.14.2.1    yamt     unsigned long ign1, ign2, ign3, ign4;
    318  1.14.2.1    yamt     int ma1 = ma & 0xffffffff;
    319  1.14.2.1    yamt     int ma2 = (ma >> 32) & 0xffffffff;
    320  1.14.2.1    yamt 
    321  1.14.2.2    yamt     _hypercall(__HYPERVISOR_update_descriptor,
    322  1.14.2.2    yamt 	_harg("1" (ma1), "2" (ma2), "3" (word1), "4" (word2)),
    323  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));
    324  1.14.2.1    yamt 
    325  1.14.2.1    yamt     return ret;
    326  1.14.2.1    yamt }
    327  1.14.2.1    yamt 
    328  1.14.2.1    yamt static __inline int
    329  1.14.2.1    yamt HYPERVISOR_memory_op(unsigned int cmd, void *arg)
    330  1.14.2.1    yamt {
    331  1.14.2.1    yamt     int ret;
    332  1.14.2.1    yamt     unsigned long ign1, ign2;
    333  1.14.2.1    yamt 
    334  1.14.2.2    yamt     _hypercall(__HYPERVISOR_memory_op, _harg("1" (cmd), "2" (arg)),
    335  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    336  1.14.2.1    yamt 
    337  1.14.2.1    yamt     return ret;
    338  1.14.2.1    yamt }
    339  1.14.2.1    yamt 
    340  1.14.2.1    yamt static __inline int
    341  1.14.2.1    yamt HYPERVISOR_update_va_mapping(unsigned long page_nr, unsigned long new_val,
    342  1.14.2.1    yamt     unsigned long flags)
    343  1.14.2.1    yamt {
    344  1.14.2.1    yamt     int ret;
    345  1.14.2.1    yamt     unsigned long ign1, ign2, ign3, ign4;
    346  1.14.2.1    yamt 
    347  1.14.2.2    yamt     _hypercall(__HYPERVISOR_update_va_mapping,
    348  1.14.2.2    yamt 	_harg("1" (page_nr), "2" (new_val), "3" (0), "4" (flags)),
    349  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));
    350  1.14.2.1    yamt 
    351  1.14.2.1    yamt #ifdef notdef
    352  1.14.2.1    yamt     if (__predict_false(ret < 0))
    353  1.14.2.1    yamt         panic("Failed update VA mapping: %08lx, %08lx, %08lx",
    354  1.14.2.1    yamt               page_nr, new_val, flags);
    355  1.14.2.1    yamt #endif
    356  1.14.2.1    yamt 
    357  1.14.2.1    yamt     return ret;
    358  1.14.2.1    yamt }
    359  1.14.2.1    yamt 
    360  1.14.2.1    yamt static __inline int
    361  1.14.2.1    yamt HYPERVISOR_xen_version(int cmd, void *arg)
    362  1.14.2.1    yamt {
    363  1.14.2.1    yamt     int ret;
    364  1.14.2.1    yamt     unsigned long ign1, ign2;
    365  1.14.2.1    yamt 
    366  1.14.2.2    yamt     _hypercall(__HYPERVISOR_xen_version, _harg("1" (cmd), "2" (arg)),
    367  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    368  1.14.2.1    yamt 
    369  1.14.2.1    yamt     return ret;
    370  1.14.2.1    yamt }
    371  1.14.2.1    yamt 
    372  1.14.2.1    yamt static __inline int
    373  1.14.2.1    yamt HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
    374  1.14.2.1    yamt {
    375  1.14.2.1    yamt     int ret;
    376  1.14.2.1    yamt     unsigned long ign1, ign2, ign3;
    377  1.14.2.1    yamt 
    378  1.14.2.2    yamt     _hypercall(__HYPERVISOR_grant_table_op,
    379  1.14.2.2    yamt 	_harg("1" (cmd), "2" (uop), "3" (count)),
    380  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));
    381  1.14.2.1    yamt 
    382  1.14.2.1    yamt     return ret;
    383  1.14.2.1    yamt }
    384  1.14.2.1    yamt 
    385  1.14.2.1    yamt static __inline int
    386  1.14.2.1    yamt HYPERVISOR_update_va_mapping_otherdomain(unsigned long page_nr,
    387  1.14.2.1    yamt     unsigned long new_val, unsigned long flags, domid_t domid)
    388  1.14.2.1    yamt {
    389  1.14.2.1    yamt     int ret;
    390  1.14.2.1    yamt     unsigned long ign1, ign2, ign3, ign4, ign5;
    391  1.14.2.1    yamt 
    392  1.14.2.2    yamt     _hypercall(__HYPERVISOR_update_va_mapping_otherdomain,
    393  1.14.2.2    yamt 	_harg("1" (page_nr), "2" (new_val), "3" (0), "4" (flags), "5" (domid)),
    394  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
    395  1.14.2.2    yamt 	    "=D" (ign5)));
    396  1.14.2.2    yamt 
    397  1.14.2.1    yamt     return ret;
    398  1.14.2.1    yamt }
    399  1.14.2.1    yamt 
    400  1.14.2.1    yamt static __inline int
    401  1.14.2.1    yamt HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
    402  1.14.2.1    yamt {
    403  1.14.2.1    yamt     long ret;
    404  1.14.2.1    yamt     unsigned long ign1, ign2, ign3;
    405  1.14.2.1    yamt 
    406  1.14.2.2    yamt     _hypercall(__HYPERVISOR_vcpu_op,
    407  1.14.2.2    yamt 	_harg("1" (cmd), "2" (vcpuid), "3" (extra_args)),
    408  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));
    409  1.14.2.1    yamt 
    410  1.14.2.1    yamt     return ret;
    411  1.14.2.1    yamt }
    412  1.14.2.1    yamt 
    413  1.14.2.1    yamt static __inline long
    414  1.14.2.1    yamt HYPERVISOR_yield(void)
    415  1.14.2.1    yamt {
    416  1.14.2.1    yamt     long ret;
    417  1.14.2.1    yamt     unsigned long ign1, ign2;
    418  1.14.2.1    yamt 
    419  1.14.2.2    yamt     _hypercall(__HYPERVISOR_sched_op, _harg("1" (SCHEDOP_yield), "2" (0)),
    420  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    421  1.14.2.1    yamt 
    422  1.14.2.1    yamt     return ret;
    423  1.14.2.1    yamt }
    424  1.14.2.1    yamt 
    425  1.14.2.1    yamt static __inline long
    426  1.14.2.1    yamt HYPERVISOR_block(void)
    427  1.14.2.1    yamt {
    428  1.14.2.1    yamt     long ret;
    429  1.14.2.1    yamt     unsigned long ign1, ign2;
    430  1.14.2.1    yamt 
    431  1.14.2.2    yamt     _hypercall(__HYPERVISOR_sched_op, _harg("1" (SCHEDOP_block), "2" (0)),
    432  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    433  1.14.2.1    yamt 
    434  1.14.2.1    yamt     return ret;
    435  1.14.2.1    yamt }
    436  1.14.2.1    yamt 
    437  1.14.2.1    yamt static __inline long
    438  1.14.2.1    yamt HYPERVISOR_shutdown(void)
    439  1.14.2.1    yamt {
    440  1.14.2.1    yamt     long ret;
    441  1.14.2.1    yamt     unsigned long ign1, ign2;
    442  1.14.2.1    yamt 
    443  1.14.2.2    yamt     _hypercall(__HYPERVISOR_sched_op,
    444  1.14.2.2    yamt 	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_poweroff)),
    445  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    446       1.1      cl 
    447       1.1      cl     return ret;
    448       1.1      cl }
    449       1.1      cl 
    450  1.14.2.1    yamt static __inline long
    451      1.10  bouyer HYPERVISOR_reboot(void)
    452       1.1      cl {
    453  1.14.2.1    yamt     long ret;
    454  1.14.2.1    yamt     unsigned long ign1, ign2;
    455      1.10  bouyer 
    456  1.14.2.2    yamt     _hypercall(__HYPERVISOR_sched_op,
    457  1.14.2.2    yamt 	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_reboot)),
    458  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    459       1.1      cl 
    460       1.1      cl     return ret;
    461       1.1      cl }
    462       1.1      cl 
    463  1.14.2.1    yamt static __inline long
    464      1.10  bouyer HYPERVISOR_suspend(unsigned long srec)
    465       1.1      cl {
    466  1.14.2.1    yamt     long ret;
    467  1.14.2.1    yamt     unsigned long ign1, ign2, ign3;
    468      1.10  bouyer 
    469  1.14.2.2    yamt     _hypercall(__HYPERVISOR_sched_op,
    470  1.14.2.2    yamt 	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_suspend), "3" (srec)),
    471  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));
    472       1.1      cl 
    473       1.1      cl     return ret;
    474       1.1      cl }
    475       1.1      cl 
    476  1.14.2.1    yamt static __inline long
    477      1.10  bouyer HYPERVISOR_set_timer_op(uint64_t timeout)
    478       1.1      cl {
    479  1.14.2.1    yamt     long ret;
    480      1.10  bouyer     unsigned long timeout_hi = (unsigned long)(timeout>>32);
    481      1.10  bouyer     unsigned long timeout_lo = (unsigned long)timeout;
    482      1.10  bouyer     unsigned long ign1, ign2;
    483      1.10  bouyer 
    484  1.14.2.2    yamt     _hypercall(__HYPERVISOR_set_timer_op,
    485  1.14.2.2    yamt 	 _harg("1" (timeout_lo), "2" (timeout_hi)),
    486  1.14.2.2    yamt 	 _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    487       1.1      cl 
    488       1.1      cl     return ret;
    489       1.1      cl }
    490  1.14.2.2    yamt #else /* !XEN3 */
    491  1.14.2.1    yamt static __inline int
    492  1.14.2.1    yamt HYPERVISOR_mmu_update(mmu_update_t *req, int count, int *success_count)
    493       1.1      cl {
    494       1.1      cl     int ret;
    495  1.14.2.1    yamt     unsigned long ign1, ign2, ign3;
    496      1.10  bouyer 
    497       1.1      cl     __asm__ __volatile__ (
    498       1.1      cl         TRAP_INSTR
    499  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    500  1.14.2.1    yamt 	: "0" (__HYPERVISOR_mmu_update), "1" (req), "2" (count),
    501  1.14.2.1    yamt 	  "3" (success_count)
    502  1.14.2.1    yamt 	: "memory" );
    503       1.1      cl 
    504       1.1      cl     return ret;
    505       1.1      cl }
    506       1.1      cl 
    507  1.14.2.1    yamt static __inline int
    508  1.14.2.1    yamt HYPERVISOR_fpu_taskswitch(void)
    509       1.1      cl {
    510       1.1      cl     int ret;
    511  1.14.2.1    yamt     __asm volatile (
    512  1.14.2.1    yamt         TRAP_INSTR
    513  1.14.2.1    yamt         : "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) : "memory" );
    514      1.10  bouyer 
    515  1.14.2.1    yamt     return ret;
    516  1.14.2.1    yamt }
    517  1.14.2.1    yamt 
    518  1.14.2.1    yamt static __inline int
    519  1.14.2.1    yamt HYPERVISOR_update_descriptor(unsigned long pa, unsigned long word1,
    520  1.14.2.1    yamt     unsigned long word2)
    521  1.14.2.1    yamt {
    522  1.14.2.1    yamt     int ret;
    523  1.14.2.1    yamt     unsigned long ign1, ign2, ign3;
    524  1.14.2.1    yamt 
    525  1.14.2.1    yamt     __asm volatile (
    526       1.1      cl         TRAP_INSTR
    527  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    528  1.14.2.1    yamt 	: "0" (__HYPERVISOR_update_descriptor), "1" (pa), "2" (word1),
    529  1.14.2.1    yamt 	  "3" (word2)
    530      1.10  bouyer 	: "memory" );
    531       1.1      cl 
    532       1.1      cl     return ret;
    533       1.1      cl }
    534       1.1      cl 
    535  1.14.2.1    yamt static __inline int
    536  1.14.2.1    yamt HYPERVISOR_yield(void)
    537       1.1      cl {
    538  1.14.2.1    yamt     int ret;
    539      1.10  bouyer     unsigned long ign1;
    540      1.10  bouyer 
    541       1.1      cl     __asm__ __volatile__ (
    542       1.1      cl         TRAP_INSTR
    543      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    544  1.14.2.1    yamt 	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_yield)
    545      1.10  bouyer 	: "memory" );
    546       1.1      cl 
    547       1.1      cl     return ret;
    548       1.1      cl }
    549       1.1      cl 
    550  1.14.2.1    yamt static __inline int
    551  1.14.2.1    yamt HYPERVISOR_block(void)
    552       1.1      cl {
    553       1.1      cl     int ret;
    554  1.14.2.1    yamt     unsigned long ign1;
    555      1.10  bouyer 
    556       1.1      cl     __asm__ __volatile__ (
    557       1.1      cl         TRAP_INSTR
    558  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1)
    559  1.14.2.1    yamt 	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_block)
    560      1.10  bouyer 	: "memory" );
    561       1.1      cl 
    562       1.1      cl     return ret;
    563       1.1      cl }
    564       1.1      cl 
    565  1.14.2.1    yamt static __inline int
    566  1.14.2.1    yamt HYPERVISOR_shutdown(void)
    567       1.1      cl {
    568       1.1      cl     int ret;
    569      1.10  bouyer     unsigned long ign1;
    570      1.10  bouyer 
    571       1.1      cl     __asm__ __volatile__ (
    572       1.1      cl         TRAP_INSTR
    573      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    574  1.14.2.1    yamt 	: "0" (__HYPERVISOR_sched_op),
    575  1.14.2.1    yamt 	  "1" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
    576  1.14.2.1    yamt         : "memory" );
    577       1.1      cl 
    578       1.1      cl     return ret;
    579       1.1      cl }
    580       1.1      cl 
    581  1.14.2.1    yamt static __inline int
    582  1.14.2.1    yamt HYPERVISOR_reboot(void)
    583       1.1      cl {
    584       1.1      cl     int ret;
    585  1.14.2.1    yamt     unsigned long ign1;
    586      1.10  bouyer 
    587       1.1      cl     __asm__ __volatile__ (
    588       1.1      cl         TRAP_INSTR
    589  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1)
    590  1.14.2.1    yamt 	: "0" (__HYPERVISOR_sched_op),
    591  1.14.2.1    yamt 	  "1" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
    592      1.10  bouyer         : "memory" );
    593       1.1      cl 
    594       1.1      cl     return ret;
    595       1.1      cl }
    596       1.1      cl 
    597  1.14.2.1    yamt static __inline int
    598  1.14.2.1    yamt HYPERVISOR_suspend(unsigned long srec)
    599       1.1      cl {
    600       1.1      cl     int ret;
    601      1.10  bouyer     unsigned long ign1, ign2;
    602      1.10  bouyer 
    603  1.14.2.1    yamt     /* NB. On suspend, control software expects a suspend record in %esi. */
    604       1.1      cl     __asm__ __volatile__ (
    605       1.1      cl         TRAP_INSTR
    606  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1), "=S" (ign2)
    607  1.14.2.1    yamt 	: "0" (__HYPERVISOR_sched_op),
    608  1.14.2.1    yamt         "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)),
    609  1.14.2.1    yamt         "S" (srec) : "memory");
    610  1.14.2.1    yamt 
    611  1.14.2.1    yamt     return ret;
    612  1.14.2.1    yamt }
    613  1.14.2.1    yamt 
    614  1.14.2.1    yamt static __inline int
    615  1.14.2.1    yamt HYPERVISOR_set_fast_trap(int idx)
    616  1.14.2.1    yamt {
    617  1.14.2.1    yamt     int ret;
    618  1.14.2.1    yamt     unsigned long ign1;
    619  1.14.2.1    yamt 
    620  1.14.2.1    yamt     __asm volatile (
    621  1.14.2.1    yamt         TRAP_INSTR
    622  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1)
    623  1.14.2.1    yamt 	: "0" (__HYPERVISOR_set_fast_trap), "1" (idx)
    624      1.10  bouyer 	: "memory" );
    625       1.1      cl 
    626       1.1      cl     return ret;
    627       1.1      cl }
    628       1.1      cl 
    629  1.14.2.1    yamt static __inline int
    630  1.14.2.1    yamt HYPERVISOR_dom_mem_op(unsigned int op, unsigned long *extent_list,
    631  1.14.2.1    yamt     unsigned long nr_extents, unsigned int extent_order)
    632  1.14.2.1    yamt {
    633  1.14.2.1    yamt     int ret;
    634  1.14.2.1    yamt     unsigned long ign1, ign2, ign3, ign4, ign5;
    635  1.14.2.1    yamt 
    636  1.14.2.1    yamt     __asm volatile (
    637  1.14.2.1    yamt         TRAP_INSTR
    638  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
    639  1.14.2.1    yamt 	  "=D" (ign5)
    640  1.14.2.1    yamt 	: "0" (__HYPERVISOR_dom_mem_op), "1" (op), "2" (extent_list),
    641  1.14.2.1    yamt 	  "3" (nr_extents), "4" (extent_order), "5" (DOMID_SELF)
    642  1.14.2.1    yamt         : "memory" );
    643  1.14.2.1    yamt 
    644  1.14.2.1    yamt     return ret;
    645  1.14.2.1    yamt }
    646  1.14.2.1    yamt 
    647  1.14.2.1    yamt static __inline int
    648      1.10  bouyer HYPERVISOR_update_va_mapping(unsigned long page_nr, unsigned long new_val,
    649      1.10  bouyer     unsigned long flags)
    650       1.1      cl {
    651      1.10  bouyer     int ret;
    652      1.10  bouyer     unsigned long ign1, ign2, ign3;
    653      1.10  bouyer 
    654  1.14.2.1    yamt     __asm volatile (
    655       1.1      cl         TRAP_INSTR
    656      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    657      1.10  bouyer 	: "0" (__HYPERVISOR_update_va_mapping),
    658      1.10  bouyer           "1" (page_nr), "2" (new_val), "3" (flags)
    659      1.10  bouyer 	: "memory" );
    660      1.10  bouyer 
    661      1.10  bouyer #ifdef notdef
    662      1.10  bouyer     if (__predict_false(ret < 0))
    663      1.10  bouyer         panic("Failed update VA mapping: %08lx, %08lx, %08lx",
    664      1.10  bouyer               page_nr, new_val, flags);
    665      1.10  bouyer #endif
    666       1.1      cl 
    667       1.1      cl     return ret;
    668       1.1      cl }
    669       1.1      cl 
    670  1.14.2.1    yamt static __inline int
    671  1.14.2.1    yamt HYPERVISOR_xen_version(int cmd)
    672       1.1      cl {
    673       1.1      cl     int ret;
    674      1.10  bouyer     unsigned long ign1;
    675      1.10  bouyer 
    676  1.14.2.1    yamt     __asm volatile (
    677       1.1      cl         TRAP_INSTR
    678      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    679  1.14.2.1    yamt 	: "0" (__HYPERVISOR_xen_version), "1" (cmd)
    680      1.10  bouyer 	: "memory" );
    681       1.1      cl 
    682       1.1      cl     return ret;
    683       1.1      cl }
    684       1.1      cl 
    685  1.14.2.1    yamt static __inline int
    686  1.14.2.1    yamt HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
    687       1.1      cl {
    688       1.1      cl     int ret;
    689  1.14.2.1    yamt     unsigned long ign1, ign2, ign3;
    690      1.10  bouyer 
    691  1.14.2.1    yamt     __asm volatile (
    692       1.1      cl         TRAP_INSTR
    693  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    694  1.14.2.1    yamt 	: "0" (__HYPERVISOR_grant_table_op), "1" (cmd), "2" (count), "3" (uop)
    695      1.10  bouyer 	: "memory" );
    696       1.1      cl 
    697       1.1      cl     return ret;
    698       1.1      cl }
    699       1.1      cl 
    700  1.14.2.1    yamt static __inline int
    701  1.14.2.1    yamt HYPERVISOR_update_va_mapping_otherdomain(unsigned long page_nr,
    702  1.14.2.1    yamt     unsigned long new_val, unsigned long flags, domid_t domid)
    703       1.1      cl {
    704       1.1      cl     int ret;
    705  1.14.2.1    yamt     unsigned long ign1, ign2, ign3, ign4;
    706      1.10  bouyer 
    707  1.14.2.1    yamt     __asm volatile (
    708       1.1      cl         TRAP_INSTR
    709  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    710  1.14.2.1    yamt 	: "0" (__HYPERVISOR_update_va_mapping_otherdomain),
    711  1.14.2.1    yamt           "1" (page_nr), "2" (new_val), "3" (flags), "4" (domid) :
    712  1.14.2.1    yamt         "memory" );
    713  1.14.2.1    yamt 
    714  1.14.2.1    yamt     return ret;
    715  1.14.2.1    yamt }
    716  1.14.2.1    yamt 
    717  1.14.2.1    yamt static __inline long
    718  1.14.2.1    yamt HYPERVISOR_set_timer_op(uint64_t timeout)
    719  1.14.2.1    yamt {
    720  1.14.2.1    yamt     long ret;
    721  1.14.2.1    yamt     unsigned long timeout_hi = (unsigned long)(timeout>>32);
    722  1.14.2.1    yamt     unsigned long timeout_lo = (unsigned long)timeout;
    723  1.14.2.1    yamt     unsigned long ign1, ign2;
    724  1.14.2.1    yamt 
    725  1.14.2.1    yamt     __asm volatile (
    726  1.14.2.1    yamt         TRAP_INSTR
    727  1.14.2.1    yamt         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    728  1.14.2.1    yamt 	: "0" (__HYPERVISOR_set_timer_op), "b" (timeout_hi), "c" (timeout_lo)
    729  1.14.2.1    yamt 	: "memory");
    730  1.14.2.1    yamt 
    731  1.14.2.1    yamt     return ret;
    732  1.14.2.1    yamt }
    733  1.14.2.1    yamt #endif /* XEN3 */
    734  1.14.2.1    yamt 
    735  1.14.2.1    yamt static __inline int
    736  1.14.2.1    yamt HYPERVISOR_multicall(void *call_list, int nr_calls)
    737  1.14.2.1    yamt {
    738  1.14.2.1    yamt     int ret;
    739  1.14.2.1    yamt     unsigned long ign1, ign2;
    740  1.14.2.1    yamt 
    741  1.14.2.2    yamt     _hypercall(__HYPERVISOR_multicall,
    742  1.14.2.2    yamt 	 _harg("1" (call_list), "2" (nr_calls)),
    743  1.14.2.2    yamt 	 _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    744       1.1      cl 
    745       1.1      cl     return ret;
    746       1.1      cl }
    747       1.1      cl 
    748  1.14.2.1    yamt 
    749  1.14.2.1    yamt static __inline int
    750  1.14.2.1    yamt HYPERVISOR_event_channel_op(void *op)
    751       1.1      cl {
    752       1.1      cl     int ret;
    753      1.10  bouyer     unsigned long ign1;
    754      1.10  bouyer 
    755  1.14.2.2    yamt     _hypercall(__HYPERVISOR_event_channel_op, _harg("1" (op)),
    756  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1)));
    757       1.1      cl 
    758       1.1      cl     return ret;
    759       1.1      cl }
    760       1.1      cl 
    761  1.14.2.1    yamt static __inline int
    762  1.14.2.1    yamt HYPERVISOR_console_io(int cmd, int count, char *str)
    763       1.1      cl {
    764       1.1      cl     int ret;
    765      1.10  bouyer     unsigned long ign1, ign2, ign3;
    766      1.10  bouyer 
    767  1.14.2.2    yamt     _hypercall(__HYPERVISOR_console_io,
    768  1.14.2.2    yamt 	_harg("1" (cmd), "2" (count), "3" (str)),
    769  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));
    770       1.1      cl 
    771       1.1      cl     return ret;
    772       1.1      cl }
    773       1.1      cl 
    774  1.14.2.1    yamt static __inline int
    775  1.14.2.1    yamt HYPERVISOR_physdev_op(void *physdev_op)
    776       1.1      cl {
    777       1.1      cl     int ret;
    778  1.14.2.1    yamt     unsigned long ign1;
    779      1.10  bouyer 
    780  1.14.2.2    yamt     _hypercall(__HYPERVISOR_physdev_op, _harg("1" (physdev_op)),
    781  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1)));
    782  1.14.2.1    yamt 
    783      1.10  bouyer     return ret;
    784      1.10  bouyer }
    785       1.1      cl 
    786  1.14.2.1    yamt static __inline int
    787      1.10  bouyer HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
    788      1.10  bouyer {
    789      1.10  bouyer     int ret;
    790      1.10  bouyer     unsigned long ign1, ign2;
    791      1.10  bouyer 
    792  1.14.2.2    yamt     _hypercall(__HYPERVISOR_vm_assist, _harg("1" (cmd), "2" (type)),
    793  1.14.2.2    yamt 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
    794       1.2      cl 
    795       1.1      cl     return ret;
    796       1.1      cl }
    797       1.1      cl 
    798  1.14.2.1    yamt /*
    799  1.14.2.1    yamt  * Force a proper event-channel callback from Xen after clearing the
    800  1.14.2.1    yamt  * callback mask. We do this in a very simple manner, by making a call
    801  1.14.2.1    yamt  * down into Xen. The pending flag will be checked by Xen on return.
    802  1.14.2.1    yamt  */
    803  1.14.2.1    yamt static __inline void hypervisor_force_callback(void)
    804  1.14.2.1    yamt {
    805  1.14.2.1    yamt #ifdef XEN3
    806  1.14.2.1    yamt 	(void)HYPERVISOR_xen_version(0, (void*)0);
    807  1.14.2.1    yamt #else
    808  1.14.2.1    yamt 	(void)HYPERVISOR_xen_version(0);
    809  1.14.2.1    yamt #endif
    810  1.14.2.1    yamt } __attribute__((no_instrument_function)) /* used by mcount */
    811  1.14.2.1    yamt 
    812  1.14.2.1    yamt static __inline void
    813  1.14.2.1    yamt hypervisor_notify_via_evtchn(unsigned int port)
    814  1.14.2.1    yamt {
    815  1.14.2.1    yamt 	evtchn_op_t op;
    816  1.14.2.1    yamt 
    817  1.14.2.1    yamt 	op.cmd = EVTCHNOP_send;
    818  1.14.2.1    yamt #ifdef XEN3
    819  1.14.2.1    yamt 	op.u.send.port = port;
    820  1.14.2.1    yamt #else
    821  1.14.2.1    yamt 	op.u.send.local_port = port;
    822  1.14.2.1    yamt #endif
    823  1.14.2.1    yamt 	(void)HYPERVISOR_event_channel_op(&op);
    824  1.14.2.1    yamt }
    825  1.14.2.1    yamt 
    826       1.1      cl #endif /* _XEN_HYPERVISOR_H_ */
    827