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