Home | History | Annotate | Line # | Download | only in include
hypervisor.h revision 1.9.2.1
      1  1.9.2.1  bouyer /*	$NetBSD: hypervisor.h,v 1.9.2.1 2004/12/13 17:52:21 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 the hypervisor interface */
     56  1.9.2.1  bouyer #include <sys/systm.h>
     57  1.9.2.1  bouyer #include <machine/xen-public/xen.h>
     58  1.9.2.1  bouyer #include <machine/xen-public/dom0_ops.h>
     59  1.9.2.1  bouyer #include <machine/xen-public/event_channel.h>
     60  1.9.2.1  bouyer #include <machine/xen-public/io/domain_controller.h>
     61  1.9.2.1  bouyer #include <machine/xen-public/io/netif.h>
     62  1.9.2.1  bouyer #include <machine/xen-public/io/blkif.h>
     63      1.8      cl 
     64  1.9.2.1  bouyer #undef u8
     65      1.8      cl #undef u16
     66      1.8      cl #undef u32
     67      1.8      cl #undef u64
     68  1.9.2.1  bouyer #undef s8
     69  1.9.2.1  bouyer #undef s16
     70  1.9.2.1  bouyer #undef s32
     71  1.9.2.1  bouyer #undef s64
     72      1.1      cl 
     73      1.1      cl 
     74      1.1      cl /*
     75      1.1      cl  * a placeholder for the start of day information passed up from the hypervisor
     76      1.1      cl  */
     77      1.1      cl union start_info_union
     78      1.1      cl {
     79      1.1      cl     start_info_t start_info;
     80      1.1      cl     char padding[512];
     81      1.1      cl };
     82      1.1      cl extern union start_info_union start_info_union;
     83      1.1      cl #define xen_start_info (start_info_union.start_info)
     84      1.1      cl 
     85      1.1      cl 
     86      1.1      cl /* hypervisor.c */
     87  1.9.2.1  bouyer void do_hypervisor_callback(struct intrframe *regs);
     88  1.9.2.1  bouyer void hypervisor_notify_via_evtchn(unsigned int);
     89  1.9.2.1  bouyer void hypervisor_enable_irq(unsigned int);
     90  1.9.2.1  bouyer void hypervisor_disable_irq(unsigned int);
     91  1.9.2.1  bouyer void hypervisor_acknowledge_irq(unsigned int);
     92  1.9.2.1  bouyer 
     93  1.9.2.1  bouyer /* hypervisor_machdep.c */
     94  1.9.2.1  bouyer void hypervisor_unmask_event(unsigned int);
     95  1.9.2.1  bouyer void hypervisor_mask_event(unsigned int);
     96  1.9.2.1  bouyer void hypervisor_clear_event(unsigned int);
     97  1.9.2.1  bouyer void hypervisor_force_callback(void);
     98      1.1      cl 
     99      1.1      cl /*
    100      1.1      cl  * Assembler stubs for hyper-calls.
    101      1.1      cl  */
    102      1.1      cl 
    103  1.9.2.1  bouyer static inline int
    104  1.9.2.1  bouyer HYPERVISOR_set_trap_table(trap_info_t *table)
    105      1.1      cl {
    106      1.1      cl     int ret;
    107  1.9.2.1  bouyer     unsigned long ign1;
    108  1.9.2.1  bouyer 
    109      1.1      cl     __asm__ __volatile__ (
    110      1.1      cl         TRAP_INSTR
    111  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    112  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_trap_table), "1" (table)
    113  1.9.2.1  bouyer 	: "memory" );
    114      1.1      cl 
    115      1.1      cl     return ret;
    116      1.1      cl }
    117      1.1      cl 
    118  1.9.2.1  bouyer static inline int
    119  1.9.2.1  bouyer HYPERVISOR_mmu_update(mmu_update_t *req, int count, int *success_count)
    120      1.1      cl {
    121      1.1      cl     int ret;
    122  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    123  1.9.2.1  bouyer 
    124      1.1      cl     __asm__ __volatile__ (
    125      1.1      cl         TRAP_INSTR
    126  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    127  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_mmu_update), "1" (req), "2" (count),
    128  1.9.2.1  bouyer 	  "3" (success_count)
    129  1.9.2.1  bouyer 	: "memory" );
    130      1.2      cl 
    131      1.1      cl     return ret;
    132      1.1      cl }
    133      1.1      cl 
    134  1.9.2.1  bouyer static inline int
    135  1.9.2.1  bouyer HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
    136      1.7      cl {
    137      1.7      cl     int ret;
    138  1.9.2.1  bouyer     unsigned long ign1, ign2;
    139  1.9.2.1  bouyer 
    140      1.7      cl     __asm__ __volatile__ (
    141      1.7      cl         TRAP_INSTR
    142  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    143  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_gdt), "1" (frame_list), "2" (entries)
    144  1.9.2.1  bouyer 	: "memory" );
    145      1.7      cl 
    146      1.7      cl     return ret;
    147      1.7      cl }
    148      1.7      cl 
    149  1.9.2.1  bouyer static inline int
    150  1.9.2.1  bouyer HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
    151      1.1      cl {
    152      1.1      cl     int ret;
    153  1.9.2.1  bouyer     unsigned long ign1, ign2;
    154  1.9.2.1  bouyer 
    155      1.1      cl     __asm__ __volatile__ (
    156      1.1      cl         TRAP_INSTR
    157  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    158  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_stack_switch), "1" (ss), "2" (esp)
    159  1.9.2.1  bouyer 	: "memory" );
    160      1.1      cl 
    161  1.9.2.1  bouyer     return ret;
    162  1.9.2.1  bouyer }
    163  1.9.2.1  bouyer 
    164  1.9.2.1  bouyer static inline int
    165  1.9.2.1  bouyer HYPERVISOR_set_callbacks(
    166  1.9.2.1  bouyer     unsigned long event_selector, unsigned long event_address,
    167  1.9.2.1  bouyer     unsigned long failsafe_selector, unsigned long failsafe_address)
    168  1.9.2.1  bouyer {
    169  1.9.2.1  bouyer     int ret;
    170  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3, ign4;
    171  1.9.2.1  bouyer 
    172  1.9.2.1  bouyer     __asm__ __volatile__ (
    173  1.9.2.1  bouyer         TRAP_INSTR
    174  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    175  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_callbacks), "1" (event_selector),
    176  1.9.2.1  bouyer 	  "2" (event_address), "3" (failsafe_selector), "4" (failsafe_address)
    177  1.9.2.1  bouyer 	: "memory" );
    178      1.1      cl 
    179      1.1      cl     return ret;
    180      1.1      cl }
    181      1.1      cl 
    182  1.9.2.1  bouyer static inline int
    183  1.9.2.1  bouyer HYPERVISOR_fpu_taskswitch(void)
    184      1.1      cl {
    185      1.1      cl     int ret;
    186      1.1      cl     __asm__ __volatile__ (
    187      1.1      cl         TRAP_INSTR
    188  1.9.2.1  bouyer         : "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) : "memory" );
    189  1.9.2.1  bouyer 
    190  1.9.2.1  bouyer     return ret;
    191  1.9.2.1  bouyer }
    192  1.9.2.1  bouyer 
    193  1.9.2.1  bouyer static inline int
    194  1.9.2.1  bouyer HYPERVISOR_yield(void)
    195  1.9.2.1  bouyer {
    196  1.9.2.1  bouyer     int ret;
    197  1.9.2.1  bouyer     unsigned long ign1;
    198      1.1      cl 
    199  1.9.2.1  bouyer     __asm__ __volatile__ (
    200  1.9.2.1  bouyer         TRAP_INSTR
    201  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    202  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_yield)
    203  1.9.2.1  bouyer 	: "memory" );
    204      1.1      cl 
    205      1.1      cl     return ret;
    206      1.1      cl }
    207      1.1      cl 
    208  1.9.2.1  bouyer static inline int
    209  1.9.2.1  bouyer HYPERVISOR_block(void)
    210      1.1      cl {
    211      1.1      cl     int ret;
    212  1.9.2.1  bouyer     unsigned long ign1;
    213  1.9.2.1  bouyer 
    214      1.1      cl     __asm__ __volatile__ (
    215      1.1      cl         TRAP_INSTR
    216  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    217  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_block)
    218  1.9.2.1  bouyer 	: "memory" );
    219      1.1      cl 
    220      1.1      cl     return ret;
    221      1.1      cl }
    222      1.1      cl 
    223  1.9.2.1  bouyer static inline int
    224  1.9.2.1  bouyer HYPERVISOR_shutdown(void)
    225      1.1      cl {
    226      1.1      cl     int ret;
    227  1.9.2.1  bouyer     unsigned long ign1;
    228  1.9.2.1  bouyer 
    229      1.1      cl     __asm__ __volatile__ (
    230      1.1      cl         TRAP_INSTR
    231  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    232  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op),
    233  1.9.2.1  bouyer 	  "1" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
    234  1.9.2.1  bouyer         : "memory" );
    235      1.1      cl 
    236      1.1      cl     return ret;
    237      1.1      cl }
    238      1.1      cl 
    239  1.9.2.1  bouyer static inline int
    240  1.9.2.1  bouyer HYPERVISOR_reboot(void)
    241      1.1      cl {
    242      1.1      cl     int ret;
    243  1.9.2.1  bouyer     unsigned long ign1;
    244  1.9.2.1  bouyer 
    245      1.1      cl     __asm__ __volatile__ (
    246      1.1      cl         TRAP_INSTR
    247  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    248  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op),
    249  1.9.2.1  bouyer 	  "1" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
    250  1.9.2.1  bouyer         : "memory" );
    251      1.1      cl 
    252      1.1      cl     return ret;
    253      1.1      cl }
    254      1.1      cl 
    255  1.9.2.1  bouyer static inline int
    256  1.9.2.1  bouyer HYPERVISOR_suspend(unsigned long srec)
    257      1.1      cl {
    258      1.1      cl     int ret;
    259  1.9.2.1  bouyer     unsigned long ign1, ign2;
    260  1.9.2.1  bouyer 
    261  1.9.2.1  bouyer     /* NB. On suspend, control software expects a suspend record in %esi. */
    262      1.1      cl     __asm__ __volatile__ (
    263      1.1      cl         TRAP_INSTR
    264  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=S" (ign2)
    265  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_sched_op),
    266  1.9.2.1  bouyer         "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)),
    267  1.9.2.1  bouyer         "S" (srec) : "memory");
    268      1.1      cl 
    269      1.1      cl     return ret;
    270      1.1      cl }
    271      1.1      cl 
    272  1.9.2.1  bouyer static inline long
    273  1.9.2.1  bouyer HYPERVISOR_set_timer_op(uint64_t timeout)
    274      1.1      cl {
    275      1.1      cl     int ret;
    276  1.9.2.1  bouyer     unsigned long timeout_hi = (unsigned long)(timeout>>32);
    277  1.9.2.1  bouyer     unsigned long timeout_lo = (unsigned long)timeout;
    278  1.9.2.1  bouyer     unsigned long ign1, ign2;
    279  1.9.2.1  bouyer 
    280      1.1      cl     __asm__ __volatile__ (
    281      1.1      cl         TRAP_INSTR
    282  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    283  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_timer_op), "b" (timeout_hi), "c" (timeout_lo)
    284  1.9.2.1  bouyer 	: "memory");
    285      1.1      cl 
    286      1.1      cl     return ret;
    287      1.1      cl }
    288      1.1      cl 
    289  1.9.2.1  bouyer static inline int
    290  1.9.2.1  bouyer HYPERVISOR_dom0_op(dom0_op_t *dom0_op)
    291      1.1      cl {
    292      1.1      cl     int ret;
    293  1.9.2.1  bouyer     unsigned long ign1;
    294  1.9.2.1  bouyer 
    295  1.9.2.1  bouyer     dom0_op->interface_version = DOM0_INTERFACE_VERSION;
    296      1.1      cl     __asm__ __volatile__ (
    297      1.1      cl         TRAP_INSTR
    298  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    299  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_dom0_op), "1" (dom0_op)
    300  1.9.2.1  bouyer 	: "memory");
    301      1.1      cl 
    302      1.1      cl     return ret;
    303      1.1      cl }
    304      1.1      cl 
    305  1.9.2.1  bouyer static inline int
    306  1.9.2.1  bouyer HYPERVISOR_set_debugreg(int reg, unsigned long value)
    307      1.1      cl {
    308      1.1      cl     int ret;
    309  1.9.2.1  bouyer     unsigned long ign1, ign2;
    310  1.9.2.1  bouyer 
    311  1.9.2.1  bouyer     __asm__ __volatile__ (
    312  1.9.2.1  bouyer         TRAP_INSTR
    313  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    314  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_debugreg), "1" (reg), "2" (value)
    315  1.9.2.1  bouyer 	: "memory" );
    316  1.9.2.1  bouyer 
    317  1.9.2.1  bouyer     return ret;
    318  1.9.2.1  bouyer }
    319  1.9.2.1  bouyer 
    320  1.9.2.1  bouyer static inline unsigned long
    321  1.9.2.1  bouyer HYPERVISOR_get_debugreg(int reg)
    322  1.9.2.1  bouyer {
    323  1.9.2.1  bouyer     unsigned long ret;
    324  1.9.2.1  bouyer     unsigned long ign1;
    325  1.9.2.1  bouyer 
    326      1.1      cl     __asm__ __volatile__ (
    327      1.1      cl         TRAP_INSTR
    328  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    329  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_get_debugreg), "1" (reg)
    330  1.9.2.1  bouyer 	: "memory" );
    331      1.1      cl 
    332      1.1      cl     return ret;
    333      1.1      cl }
    334      1.1      cl 
    335  1.9.2.1  bouyer static inline int
    336  1.9.2.1  bouyer HYPERVISOR_update_descriptor(unsigned long pa, unsigned long word1,
    337  1.9.2.1  bouyer     unsigned long word2)
    338      1.1      cl {
    339      1.1      cl     int ret;
    340  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    341  1.9.2.1  bouyer 
    342      1.1      cl     __asm__ __volatile__ (
    343      1.1      cl         TRAP_INSTR
    344  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    345  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_update_descriptor), "1" (pa), "2" (word1),
    346  1.9.2.1  bouyer 	  "3" (word2)
    347  1.9.2.1  bouyer 	: "memory" );
    348      1.1      cl 
    349      1.1      cl     return ret;
    350      1.1      cl }
    351      1.1      cl 
    352  1.9.2.1  bouyer static inline int
    353  1.9.2.1  bouyer HYPERVISOR_set_fast_trap(int idx)
    354      1.1      cl {
    355      1.1      cl     int ret;
    356  1.9.2.1  bouyer     unsigned long ign1;
    357  1.9.2.1  bouyer 
    358      1.1      cl     __asm__ __volatile__ (
    359      1.1      cl         TRAP_INSTR
    360  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    361  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_set_fast_trap), "1" (idx)
    362  1.9.2.1  bouyer 	: "memory" );
    363      1.1      cl 
    364      1.1      cl     return ret;
    365      1.1      cl }
    366      1.1      cl 
    367  1.9.2.1  bouyer static inline int
    368  1.9.2.1  bouyer HYPERVISOR_dom_mem_op(unsigned int op, unsigned long *extent_list,
    369  1.9.2.1  bouyer     unsigned long nr_extents, unsigned int extent_order)
    370      1.1      cl {
    371      1.1      cl     int ret;
    372  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3, ign4, ign5;
    373  1.9.2.1  bouyer 
    374      1.1      cl     __asm__ __volatile__ (
    375      1.1      cl         TRAP_INSTR
    376  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
    377  1.9.2.1  bouyer 	  "=D" (ign5)
    378  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_dom_mem_op), "1" (op), "2" (extent_list),
    379  1.9.2.1  bouyer 	  "3" (nr_extents), "4" (extent_order), "5" (DOMID_SELF)
    380  1.9.2.1  bouyer         : "memory" );
    381      1.1      cl 
    382      1.1      cl     return ret;
    383      1.1      cl }
    384      1.1      cl 
    385  1.9.2.1  bouyer static inline int
    386  1.9.2.1  bouyer HYPERVISOR_multicall(void *call_list, int nr_calls)
    387      1.1      cl {
    388      1.1      cl     int ret;
    389  1.9.2.1  bouyer     unsigned long ign1, ign2;
    390  1.9.2.1  bouyer 
    391      1.1      cl     __asm__ __volatile__ (
    392      1.1      cl         TRAP_INSTR
    393  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    394  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_multicall), "1" (call_list), "2" (nr_calls)
    395  1.9.2.1  bouyer 	: "memory" );
    396      1.1      cl 
    397      1.1      cl     return ret;
    398      1.1      cl }
    399      1.1      cl 
    400  1.9.2.1  bouyer static inline int
    401  1.9.2.1  bouyer HYPERVISOR_update_va_mapping(unsigned long page_nr, unsigned long new_val,
    402  1.9.2.1  bouyer     unsigned long flags)
    403      1.1      cl {
    404  1.9.2.1  bouyer     int ret;
    405  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    406  1.9.2.1  bouyer 
    407      1.1      cl     __asm__ __volatile__ (
    408      1.1      cl         TRAP_INSTR
    409  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    410  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_update_va_mapping),
    411  1.9.2.1  bouyer           "1" (page_nr), "2" (new_val), "3" (flags)
    412  1.9.2.1  bouyer 	: "memory" );
    413  1.9.2.1  bouyer 
    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.1      cl 
    418      1.1      cl     return ret;
    419      1.1      cl }
    420      1.1      cl 
    421  1.9.2.1  bouyer static inline int
    422  1.9.2.1  bouyer HYPERVISOR_event_channel_op(void *op)
    423      1.1      cl {
    424      1.1      cl     int ret;
    425  1.9.2.1  bouyer     unsigned long ign1;
    426  1.9.2.1  bouyer 
    427      1.1      cl     __asm__ __volatile__ (
    428      1.1      cl         TRAP_INSTR
    429  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    430  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_event_channel_op), "1" (op)
    431  1.9.2.1  bouyer 	: "memory" );
    432      1.1      cl 
    433      1.1      cl     return ret;
    434      1.1      cl }
    435      1.1      cl 
    436  1.9.2.1  bouyer static inline int
    437  1.9.2.1  bouyer HYPERVISOR_xen_version(int cmd)
    438      1.1      cl {
    439      1.1      cl     int ret;
    440  1.9.2.1  bouyer     unsigned long ign1;
    441  1.9.2.1  bouyer 
    442      1.1      cl     __asm__ __volatile__ (
    443      1.1      cl         TRAP_INSTR
    444  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    445  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_xen_version), "1" (cmd)
    446  1.9.2.1  bouyer 	: "memory" );
    447      1.1      cl 
    448      1.1      cl     return ret;
    449      1.1      cl }
    450      1.1      cl 
    451  1.9.2.1  bouyer static inline int
    452  1.9.2.1  bouyer HYPERVISOR_console_io(int cmd, int count, char *str)
    453      1.1      cl {
    454      1.1      cl     int ret;
    455  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    456  1.9.2.1  bouyer 
    457      1.1      cl     __asm__ __volatile__ (
    458      1.1      cl         TRAP_INSTR
    459  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    460  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_console_io), "1" (cmd), "2" (count), "3" (str)
    461  1.9.2.1  bouyer 	: "memory" );
    462      1.1      cl 
    463      1.1      cl     return ret;
    464      1.1      cl }
    465      1.1      cl 
    466  1.9.2.1  bouyer static inline int
    467  1.9.2.1  bouyer HYPERVISOR_physdev_op(void *physdev_op)
    468      1.1      cl {
    469      1.1      cl     int ret;
    470  1.9.2.1  bouyer     unsigned long ign1;
    471  1.9.2.1  bouyer 
    472      1.1      cl     __asm__ __volatile__ (
    473      1.1      cl         TRAP_INSTR
    474  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1)
    475  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_physdev_op), "1" (physdev_op)
    476  1.9.2.1  bouyer 	: "memory" );
    477      1.1      cl 
    478      1.1      cl     return ret;
    479      1.1      cl }
    480      1.1      cl 
    481  1.9.2.1  bouyer static inline int
    482  1.9.2.1  bouyer HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
    483      1.1      cl {
    484      1.1      cl     int ret;
    485  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3;
    486  1.9.2.1  bouyer 
    487      1.1      cl     __asm__ __volatile__ (
    488      1.1      cl         TRAP_INSTR
    489  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    490  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_grant_table_op), "1" (cmd), "2" (count), "3" (uop)
    491  1.9.2.1  bouyer 	: "memory" );
    492      1.1      cl 
    493      1.1      cl     return ret;
    494      1.1      cl }
    495      1.1      cl 
    496  1.9.2.1  bouyer static inline int
    497  1.9.2.1  bouyer HYPERVISOR_update_va_mapping_otherdomain(unsigned long page_nr,
    498  1.9.2.1  bouyer     unsigned long new_val, unsigned long flags, domid_t domid)
    499      1.1      cl {
    500      1.1      cl     int ret;
    501  1.9.2.1  bouyer     unsigned long ign1, ign2, ign3, ign4;
    502  1.9.2.1  bouyer 
    503      1.1      cl     __asm__ __volatile__ (
    504      1.1      cl         TRAP_INSTR
    505  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    506  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_update_va_mapping_otherdomain),
    507  1.9.2.1  bouyer           "1" (page_nr), "2" (new_val), "3" (flags), "4" (domid) :
    508  1.9.2.1  bouyer         "memory" );
    509  1.9.2.1  bouyer 
    510  1.9.2.1  bouyer     return ret;
    511  1.9.2.1  bouyer }
    512      1.1      cl 
    513  1.9.2.1  bouyer static inline int
    514  1.9.2.1  bouyer HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
    515  1.9.2.1  bouyer {
    516  1.9.2.1  bouyer     int ret;
    517  1.9.2.1  bouyer     unsigned long ign1, ign2;
    518  1.9.2.1  bouyer 
    519  1.9.2.1  bouyer     __asm__ __volatile__ (
    520  1.9.2.1  bouyer         TRAP_INSTR
    521  1.9.2.1  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    522  1.9.2.1  bouyer 	: "0" (__HYPERVISOR_vm_assist), "1" (cmd), "2" (type)
    523  1.9.2.1  bouyer 	: "memory" );
    524      1.2      cl 
    525      1.1      cl     return ret;
    526      1.1      cl }
    527      1.1      cl 
    528      1.1      cl #endif /* _XEN_HYPERVISOR_H_ */
    529