Home | History | Annotate | Line # | Download | only in include
hypervisor.h revision 1.9.2.2
      1  1.9.2.2  bouyer /*	$NetBSD: hypervisor.h,v 1.9.2.2 2004/12/17 10:34:15 bouyer Exp $	*/
      2      1.1      cl 
      3      1.1      cl /*
      4      1.1      cl  *
      5      1.1      cl  * Communication to/from hypervisor.
      6      1.1      cl  *
      7  1.9.2.1  bouyer  * Copyright (c) 2002-2004, K A Fraser
      8      1.1      cl  *
      9      1.1      cl  * Permission is hereby granted, free of charge, to any person obtaining a copy
     10  1.9.2.1  bouyer  * of this source file (the "Software"), to deal in the Software without
     11  1.9.2.1  bouyer  * restriction, including without limitation the rights to use, copy, modify,
     12  1.9.2.1  bouyer  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
     13  1.9.2.1  bouyer  * and to permit persons to whom the Software is furnished to do so, subject to
     14  1.9.2.1  bouyer  * the following conditions:
     15      1.1      cl  *
     16      1.1      cl  * The above copyright notice and this permission notice shall be included in
     17      1.1      cl  * all copies or substantial portions of the Software.
     18      1.1      cl  *
     19  1.9.2.1  bouyer  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     20  1.9.2.1  bouyer  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     21  1.9.2.1  bouyer  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     22  1.9.2.1  bouyer  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     23  1.9.2.1  bouyer  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     24  1.9.2.1  bouyer  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     25  1.9.2.1  bouyer  * IN THE SOFTWARE.
     26      1.1      cl  */
     27      1.1      cl 
     28      1.1      cl 
     29      1.1      cl #ifndef _XEN_HYPERVISOR_H_
     30      1.1      cl #define _XEN_HYPERVISOR_H_
     31      1.1      cl 
     32      1.1      cl 
     33      1.4      cl struct hypervisor_attach_args {
     34      1.4      cl 	const char 		*haa_busname;
     35      1.4      cl };
     36      1.4      cl 
     37      1.5      cl struct xencons_attach_args {
     38      1.4      cl 	const char 		*xa_device;
     39      1.1      cl };
     40      1.1      cl 
     41      1.1      cl struct xen_npx_attach_args {
     42      1.4      cl 	const char 		*xa_device;
     43      1.1      cl };
     44      1.1      cl 
     45      1.1      cl 
     46  1.9.2.1  bouyer #define	u8 uint8_t
     47      1.8      cl #define	u16 uint16_t
     48      1.8      cl #define	u32 uint32_t
     49      1.8      cl #define	u64 uint64_t
     50  1.9.2.1  bouyer #define	s8 int8_t
     51  1.9.2.1  bouyer #define	s16 int16_t
     52  1.9.2.1  bouyer #define	s32 int32_t
     53  1.9.2.1  bouyer #define	s64 int64_t
     54  1.9.2.1  bouyer 
     55  1.9.2.1  bouyer #include <machine/xen-public/xen.h>
     56  1.9.2.1  bouyer #include <machine/xen-public/dom0_ops.h>
     57  1.9.2.1  bouyer #include <machine/xen-public/event_channel.h>
     58  1.9.2.1  bouyer #include <machine/xen-public/io/domain_controller.h>
     59  1.9.2.1  bouyer #include <machine/xen-public/io/netif.h>
     60  1.9.2.1  bouyer #include <machine/xen-public/io/blkif.h>
     61      1.8      cl 
     62  1.9.2.1  bouyer #undef u8
     63      1.8      cl #undef u16
     64      1.8      cl #undef u32
     65      1.8      cl #undef u64
     66  1.9.2.1  bouyer #undef s8
     67  1.9.2.1  bouyer #undef s16
     68  1.9.2.1  bouyer #undef s32
     69  1.9.2.1  bouyer #undef s64
     70      1.1      cl 
     71      1.1      cl 
     72      1.1      cl /*
     73      1.1      cl  * a placeholder for the start of day information passed up from the hypervisor
     74      1.1      cl  */
     75      1.1      cl union start_info_union
     76      1.1      cl {
     77      1.1      cl     start_info_t start_info;
     78      1.1      cl     char padding[512];
     79      1.1      cl };
     80      1.1      cl extern union start_info_union start_info_union;
     81      1.1      cl #define xen_start_info (start_info_union.start_info)
     82      1.1      cl 
     83      1.1      cl 
     84      1.1      cl /* hypervisor.c */
     85  1.9.2.2  bouyer struct intrframe;
     86  1.9.2.1  bouyer void do_hypervisor_callback(struct intrframe *regs);
     87  1.9.2.1  bouyer void hypervisor_notify_via_evtchn(unsigned int);
     88  1.9.2.1  bouyer void hypervisor_enable_irq(unsigned int);
     89  1.9.2.1  bouyer void hypervisor_disable_irq(unsigned int);
     90  1.9.2.1  bouyer void hypervisor_acknowledge_irq(unsigned int);
     91  1.9.2.1  bouyer 
     92  1.9.2.1  bouyer /* hypervisor_machdep.c */
     93  1.9.2.1  bouyer void hypervisor_unmask_event(unsigned int);
     94  1.9.2.1  bouyer void hypervisor_mask_event(unsigned int);
     95  1.9.2.1  bouyer void hypervisor_clear_event(unsigned int);
     96  1.9.2.1  bouyer void hypervisor_force_callback(void);
     97      1.1      cl 
     98      1.1      cl /*
     99      1.1      cl  * Assembler stubs for hyper-calls.
    100      1.1      cl  */
    101      1.1      cl 
    102  1.9.2.1  bouyer static inline int
    103  1.9.2.1  bouyer HYPERVISOR_set_trap_table(trap_info_t *table)
    104      1.1      cl {
    105      1.1      cl     int ret;
    106  1.9.2.1  bouyer     unsigned long ign1;
    107  1.9.2.1  bouyer 
    108      1.1      cl     __asm__ __volatile__ (
    109      1.1      cl         TRAP_INSTR
    110  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    111  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_trap_table), "1" (table)
    112  1.9.2.1  bouyer 	: "memory" );
    113      1.1      cl 
    114      1.1      cl     return ret;
    115      1.1      cl }
    116      1.1      cl 
    117  1.9.2.1  bouyer static inline int
    118  1.9.2.1  bouyer HYPERVISOR_mmu_update(mmu_update_t *req, int count, int *success_count)
    119      1.1      cl {
    120      1.1      cl     int ret;
    121  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    122  1.9.2.1  bouyer 
    123      1.1      cl     __asm__ __volatile__ (
    124      1.1      cl         TRAP_INSTR
    125  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    126  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_mmu_update), "1" (req), "2" (count),
    127  1.9.2.1  bouyer 	  "3" (success_count)
    128  1.9.2.1  bouyer 	: "memory" );
    129      1.2      cl 
    130      1.1      cl     return ret;
    131      1.1      cl }
    132      1.1      cl 
    133  1.9.2.1  bouyer static inline int
    134  1.9.2.1  bouyer HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
    135      1.7      cl {
    136      1.7      cl     int ret;
    137  1.9.2.1  bouyer     unsigned long ign1, ign2;
    138  1.9.2.1  bouyer 
    139      1.7      cl     __asm__ __volatile__ (
    140      1.7      cl         TRAP_INSTR
    141  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    142  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_gdt), "1" (frame_list), "2" (entries)
    143  1.9.2.1  bouyer 	: "memory" );
    144      1.7      cl 
    145      1.7      cl     return ret;
    146      1.7      cl }
    147      1.7      cl 
    148  1.9.2.1  bouyer static inline int
    149  1.9.2.1  bouyer HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
    150      1.1      cl {
    151      1.1      cl     int ret;
    152  1.9.2.1  bouyer     unsigned long ign1, ign2;
    153  1.9.2.1  bouyer 
    154      1.1      cl     __asm__ __volatile__ (
    155      1.1      cl         TRAP_INSTR
    156  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    157  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_stack_switch), "1" (ss), "2" (esp)
    158  1.9.2.1  bouyer 	: "memory" );
    159      1.1      cl 
    160  1.9.2.1  bouyer     return ret;
    161  1.9.2.1  bouyer }
    162  1.9.2.1  bouyer 
    163  1.9.2.1  bouyer static inline int
    164  1.9.2.1  bouyer HYPERVISOR_set_callbacks(
    165  1.9.2.1  bouyer     unsigned long event_selector, unsigned long event_address,
    166  1.9.2.1  bouyer     unsigned long failsafe_selector, unsigned long failsafe_address)
    167  1.9.2.1  bouyer {
    168  1.9.2.1  bouyer     int ret;
    169  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3, ign4;
    170  1.9.2.1  bouyer 
    171  1.9.2.1  bouyer     __asm__ __volatile__ (
    172  1.9.2.1  bouyer         TRAP_INSTR
    173  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    174  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_callbacks), "1" (event_selector),
    175  1.9.2.1  bouyer 	  "2" (event_address), "3" (failsafe_selector), "4" (failsafe_address)
    176  1.9.2.1  bouyer 	: "memory" );
    177      1.1      cl 
    178      1.1      cl     return ret;
    179      1.1      cl }
    180      1.1      cl 
    181  1.9.2.1  bouyer static inline int
    182  1.9.2.1  bouyer HYPERVISOR_fpu_taskswitch(void)
    183      1.1      cl {
    184      1.1      cl     int ret;
    185      1.1      cl     __asm__ __volatile__ (
    186      1.1      cl         TRAP_INSTR
    187  1.9.2.1  bouyer         : "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) : "memory" );
    188  1.9.2.1  bouyer 
    189  1.9.2.1  bouyer     return ret;
    190  1.9.2.1  bouyer }
    191  1.9.2.1  bouyer 
    192  1.9.2.1  bouyer static inline int
    193  1.9.2.1  bouyer HYPERVISOR_yield(void)
    194  1.9.2.1  bouyer {
    195  1.9.2.1  bouyer     int ret;
    196  1.9.2.1  bouyer     unsigned long ign1;
    197      1.1      cl 
    198  1.9.2.1  bouyer     __asm__ __volatile__ (
    199  1.9.2.1  bouyer         TRAP_INSTR
    200  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    201  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_yield)
    202  1.9.2.1  bouyer 	: "memory" );
    203      1.1      cl 
    204      1.1      cl     return ret;
    205      1.1      cl }
    206      1.1      cl 
    207  1.9.2.1  bouyer static inline int
    208  1.9.2.1  bouyer HYPERVISOR_block(void)
    209      1.1      cl {
    210      1.1      cl     int ret;
    211  1.9.2.1  bouyer     unsigned long ign1;
    212  1.9.2.1  bouyer 
    213      1.1      cl     __asm__ __volatile__ (
    214      1.1      cl         TRAP_INSTR
    215  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    216  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_block)
    217  1.9.2.1  bouyer 	: "memory" );
    218      1.1      cl 
    219      1.1      cl     return ret;
    220      1.1      cl }
    221      1.1      cl 
    222  1.9.2.1  bouyer static inline int
    223  1.9.2.1  bouyer HYPERVISOR_shutdown(void)
    224      1.1      cl {
    225      1.1      cl     int ret;
    226  1.9.2.1  bouyer     unsigned long ign1;
    227  1.9.2.1  bouyer 
    228      1.1      cl     __asm__ __volatile__ (
    229      1.1      cl         TRAP_INSTR
    230  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    231  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op),
    232  1.9.2.1  bouyer 	  "1" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
    233  1.9.2.1  bouyer         : "memory" );
    234      1.1      cl 
    235      1.1      cl     return ret;
    236      1.1      cl }
    237      1.1      cl 
    238  1.9.2.1  bouyer static inline int
    239  1.9.2.1  bouyer HYPERVISOR_reboot(void)
    240      1.1      cl {
    241      1.1      cl     int ret;
    242  1.9.2.1  bouyer     unsigned long ign1;
    243  1.9.2.1  bouyer 
    244      1.1      cl     __asm__ __volatile__ (
    245      1.1      cl         TRAP_INSTR
    246  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    247  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op),
    248  1.9.2.1  bouyer 	  "1" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
    249  1.9.2.1  bouyer         : "memory" );
    250      1.1      cl 
    251      1.1      cl     return ret;
    252      1.1      cl }
    253      1.1      cl 
    254  1.9.2.1  bouyer static inline int
    255  1.9.2.1  bouyer HYPERVISOR_suspend(unsigned long srec)
    256      1.1      cl {
    257      1.1      cl     int ret;
    258  1.9.2.1  bouyer     unsigned long ign1, ign2;
    259  1.9.2.1  bouyer 
    260  1.9.2.1  bouyer     /* NB. On suspend, control software expects a suspend record in %esi. */
    261      1.1      cl     __asm__ __volatile__ (
    262      1.1      cl         TRAP_INSTR
    263  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=S" (ign2)
    264  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op),
    265  1.9.2.1  bouyer         "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)),
    266  1.9.2.1  bouyer         "S" (srec) : "memory");
    267      1.1      cl 
    268      1.1      cl     return ret;
    269      1.1      cl }
    270      1.1      cl 
    271  1.9.2.1  bouyer static inline long
    272  1.9.2.1  bouyer HYPERVISOR_set_timer_op(uint64_t timeout)
    273      1.1      cl {
    274      1.1      cl     int ret;
    275  1.9.2.1  bouyer     unsigned long timeout_hi = (unsigned long)(timeout>>32);
    276  1.9.2.1  bouyer     unsigned long timeout_lo = (unsigned long)timeout;
    277  1.9.2.1  bouyer     unsigned long ign1, ign2;
    278  1.9.2.1  bouyer 
    279      1.1      cl     __asm__ __volatile__ (
    280      1.1      cl         TRAP_INSTR
    281  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    282  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_timer_op), "b" (timeout_hi), "c" (timeout_lo)
    283  1.9.2.1  bouyer 	: "memory");
    284      1.1      cl 
    285      1.1      cl     return ret;
    286      1.1      cl }
    287      1.1      cl 
    288  1.9.2.1  bouyer static inline int
    289  1.9.2.1  bouyer HYPERVISOR_dom0_op(dom0_op_t *dom0_op)
    290      1.1      cl {
    291      1.1      cl     int ret;
    292  1.9.2.1  bouyer     unsigned long ign1;
    293  1.9.2.1  bouyer 
    294  1.9.2.1  bouyer     dom0_op->interface_version = DOM0_INTERFACE_VERSION;
    295      1.1      cl     __asm__ __volatile__ (
    296      1.1      cl         TRAP_INSTR
    297  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    298  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_dom0_op), "1" (dom0_op)
    299  1.9.2.1  bouyer 	: "memory");
    300      1.1      cl 
    301      1.1      cl     return ret;
    302      1.1      cl }
    303      1.1      cl 
    304  1.9.2.1  bouyer static inline int
    305  1.9.2.1  bouyer HYPERVISOR_set_debugreg(int reg, unsigned long value)
    306      1.1      cl {
    307      1.1      cl     int ret;
    308  1.9.2.1  bouyer     unsigned long ign1, ign2;
    309  1.9.2.1  bouyer 
    310  1.9.2.1  bouyer     __asm__ __volatile__ (
    311  1.9.2.1  bouyer         TRAP_INSTR
    312  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    313  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_debugreg), "1" (reg), "2" (value)
    314  1.9.2.1  bouyer 	: "memory" );
    315  1.9.2.1  bouyer 
    316  1.9.2.1  bouyer     return ret;
    317  1.9.2.1  bouyer }
    318  1.9.2.1  bouyer 
    319  1.9.2.1  bouyer static inline unsigned long
    320  1.9.2.1  bouyer HYPERVISOR_get_debugreg(int reg)
    321  1.9.2.1  bouyer {
    322  1.9.2.1  bouyer     unsigned long ret;
    323  1.9.2.1  bouyer     unsigned long ign1;
    324  1.9.2.1  bouyer 
    325      1.1      cl     __asm__ __volatile__ (
    326      1.1      cl         TRAP_INSTR
    327  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    328  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_get_debugreg), "1" (reg)
    329  1.9.2.1  bouyer 	: "memory" );
    330      1.1      cl 
    331      1.1      cl     return ret;
    332      1.1      cl }
    333      1.1      cl 
    334  1.9.2.1  bouyer static inline int
    335  1.9.2.1  bouyer HYPERVISOR_update_descriptor(unsigned long pa, unsigned long word1,
    336  1.9.2.1  bouyer     unsigned long word2)
    337      1.1      cl {
    338      1.1      cl     int ret;
    339  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    340  1.9.2.1  bouyer 
    341      1.1      cl     __asm__ __volatile__ (
    342      1.1      cl         TRAP_INSTR
    343  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    344  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_update_descriptor), "1" (pa), "2" (word1),
    345  1.9.2.1  bouyer 	  "3" (word2)
    346  1.9.2.1  bouyer 	: "memory" );
    347      1.1      cl 
    348      1.1      cl     return ret;
    349      1.1      cl }
    350      1.1      cl 
    351  1.9.2.1  bouyer static inline int
    352  1.9.2.1  bouyer HYPERVISOR_set_fast_trap(int idx)
    353      1.1      cl {
    354      1.1      cl     int ret;
    355  1.9.2.1  bouyer     unsigned long ign1;
    356  1.9.2.1  bouyer 
    357      1.1      cl     __asm__ __volatile__ (
    358      1.1      cl         TRAP_INSTR
    359  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    360  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_fast_trap), "1" (idx)
    361  1.9.2.1  bouyer 	: "memory" );
    362      1.1      cl 
    363      1.1      cl     return ret;
    364      1.1      cl }
    365      1.1      cl 
    366  1.9.2.1  bouyer static inline int
    367  1.9.2.1  bouyer HYPERVISOR_dom_mem_op(unsigned int op, unsigned long *extent_list,
    368  1.9.2.1  bouyer     unsigned long nr_extents, unsigned int extent_order)
    369      1.1      cl {
    370      1.1      cl     int ret;
    371  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3, ign4, ign5;
    372  1.9.2.1  bouyer 
    373      1.1      cl     __asm__ __volatile__ (
    374      1.1      cl         TRAP_INSTR
    375  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
    376  1.9.2.1  bouyer 	  "=D" (ign5)
    377  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_dom_mem_op), "1" (op), "2" (extent_list),
    378  1.9.2.1  bouyer 	  "3" (nr_extents), "4" (extent_order), "5" (DOMID_SELF)
    379  1.9.2.1  bouyer         : "memory" );
    380      1.1      cl 
    381      1.1      cl     return ret;
    382      1.1      cl }
    383      1.1      cl 
    384  1.9.2.1  bouyer static inline int
    385  1.9.2.1  bouyer HYPERVISOR_multicall(void *call_list, int nr_calls)
    386      1.1      cl {
    387      1.1      cl     int ret;
    388  1.9.2.1  bouyer     unsigned long ign1, ign2;
    389  1.9.2.1  bouyer 
    390      1.1      cl     __asm__ __volatile__ (
    391      1.1      cl         TRAP_INSTR
    392  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    393  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_multicall), "1" (call_list), "2" (nr_calls)
    394  1.9.2.1  bouyer 	: "memory" );
    395      1.1      cl 
    396      1.1      cl     return ret;
    397      1.1      cl }
    398      1.1      cl 
    399  1.9.2.1  bouyer static inline int
    400  1.9.2.1  bouyer HYPERVISOR_update_va_mapping(unsigned long page_nr, unsigned long new_val,
    401  1.9.2.1  bouyer     unsigned long flags)
    402      1.1      cl {
    403  1.9.2.1  bouyer     int ret;
    404  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    405  1.9.2.1  bouyer 
    406      1.1      cl     __asm__ __volatile__ (
    407      1.1      cl         TRAP_INSTR
    408  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    409  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_update_va_mapping),
    410  1.9.2.1  bouyer           "1" (page_nr), "2" (new_val), "3" (flags)
    411  1.9.2.1  bouyer 	: "memory" );
    412  1.9.2.1  bouyer 
    413  1.9.2.2  bouyer #ifdef notdef
    414  1.9.2.1  bouyer     if (__predict_false(ret < 0))
    415  1.9.2.1  bouyer         panic("Failed update VA mapping: %08lx, %08lx, %08lx",
    416  1.9.2.1  bouyer               page_nr, new_val, flags);
    417  1.9.2.2  bouyer #endif
    418      1.1      cl 
    419      1.1      cl     return ret;
    420      1.1      cl }
    421      1.1      cl 
    422  1.9.2.1  bouyer static inline int
    423  1.9.2.1  bouyer HYPERVISOR_event_channel_op(void *op)
    424      1.1      cl {
    425      1.1      cl     int ret;
    426  1.9.2.1  bouyer     unsigned long ign1;
    427  1.9.2.1  bouyer 
    428      1.1      cl     __asm__ __volatile__ (
    429      1.1      cl         TRAP_INSTR
    430  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    431  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_event_channel_op), "1" (op)
    432  1.9.2.1  bouyer 	: "memory" );
    433      1.1      cl 
    434      1.1      cl     return ret;
    435      1.1      cl }
    436      1.1      cl 
    437  1.9.2.1  bouyer static inline int
    438  1.9.2.1  bouyer HYPERVISOR_xen_version(int cmd)
    439      1.1      cl {
    440      1.1      cl     int ret;
    441  1.9.2.1  bouyer     unsigned long ign1;
    442  1.9.2.1  bouyer 
    443      1.1      cl     __asm__ __volatile__ (
    444      1.1      cl         TRAP_INSTR
    445  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    446  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_xen_version), "1" (cmd)
    447  1.9.2.1  bouyer 	: "memory" );
    448      1.1      cl 
    449      1.1      cl     return ret;
    450      1.1      cl }
    451      1.1      cl 
    452  1.9.2.1  bouyer static inline int
    453  1.9.2.1  bouyer HYPERVISOR_console_io(int cmd, int count, char *str)
    454      1.1      cl {
    455      1.1      cl     int ret;
    456  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    457  1.9.2.1  bouyer 
    458      1.1      cl     __asm__ __volatile__ (
    459      1.1      cl         TRAP_INSTR
    460  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    461  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_console_io), "1" (cmd), "2" (count), "3" (str)
    462  1.9.2.1  bouyer 	: "memory" );
    463      1.1      cl 
    464      1.1      cl     return ret;
    465      1.1      cl }
    466      1.1      cl 
    467  1.9.2.1  bouyer static inline int
    468  1.9.2.1  bouyer HYPERVISOR_physdev_op(void *physdev_op)
    469      1.1      cl {
    470      1.1      cl     int ret;
    471  1.9.2.1  bouyer     unsigned long ign1;
    472  1.9.2.1  bouyer 
    473      1.1      cl     __asm__ __volatile__ (
    474      1.1      cl         TRAP_INSTR
    475  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    476  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_physdev_op), "1" (physdev_op)
    477  1.9.2.1  bouyer 	: "memory" );
    478      1.1      cl 
    479      1.1      cl     return ret;
    480      1.1      cl }
    481      1.1      cl 
    482  1.9.2.1  bouyer static inline int
    483  1.9.2.1  bouyer HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
    484      1.1      cl {
    485      1.1      cl     int ret;
    486  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    487  1.9.2.1  bouyer 
    488      1.1      cl     __asm__ __volatile__ (
    489      1.1      cl         TRAP_INSTR
    490  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    491  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_grant_table_op), "1" (cmd), "2" (count), "3" (uop)
    492  1.9.2.1  bouyer 	: "memory" );
    493      1.1      cl 
    494      1.1      cl     return ret;
    495      1.1      cl }
    496      1.1      cl 
    497  1.9.2.1  bouyer static inline int
    498  1.9.2.1  bouyer HYPERVISOR_update_va_mapping_otherdomain(unsigned long page_nr,
    499  1.9.2.1  bouyer     unsigned long new_val, unsigned long flags, domid_t domid)
    500      1.1      cl {
    501      1.1      cl     int ret;
    502  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3, ign4;
    503  1.9.2.1  bouyer 
    504      1.1      cl     __asm__ __volatile__ (
    505      1.1      cl         TRAP_INSTR
    506  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    507  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_update_va_mapping_otherdomain),
    508  1.9.2.1  bouyer           "1" (page_nr), "2" (new_val), "3" (flags), "4" (domid) :
    509  1.9.2.1  bouyer         "memory" );
    510  1.9.2.1  bouyer 
    511  1.9.2.1  bouyer     return ret;
    512  1.9.2.1  bouyer }
    513      1.1      cl 
    514  1.9.2.1  bouyer static inline int
    515  1.9.2.1  bouyer HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
    516  1.9.2.1  bouyer {
    517  1.9.2.1  bouyer     int ret;
    518  1.9.2.1  bouyer     unsigned long ign1, ign2;
    519  1.9.2.1  bouyer 
    520  1.9.2.1  bouyer     __asm__ __volatile__ (
    521  1.9.2.1  bouyer         TRAP_INSTR
    522  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    523  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_vm_assist), "1" (cmd), "2" (type)
    524  1.9.2.1  bouyer 	: "memory" );
    525      1.2      cl 
    526      1.1      cl     return ret;
    527      1.1      cl }
    528      1.1      cl 
    529      1.1      cl #endif /* _XEN_HYPERVISOR_H_ */
    530