Home | History | Annotate | Line # | Download | only in include
hypervisor.h revision 1.10.2.5
      1  1.10.2.5     riz /*	$NetBSD: hypervisor.h,v 1.10.2.5 2006/01/05 05:59:03 riz 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.2.1    tron void hypervisor_enable_event(unsigned int);
     89      1.10  bouyer 
     90      1.10  bouyer /* hypervisor_machdep.c */
     91      1.10  bouyer void hypervisor_unmask_event(unsigned int);
     92      1.10  bouyer void hypervisor_mask_event(unsigned int);
     93      1.10  bouyer void hypervisor_clear_event(unsigned int);
     94  1.10.2.2    tron void hypervisor_enable_ipl(unsigned int);
     95  1.10.2.3    tron void hypervisor_set_ipending(u_int32_t, int, int);
     96       1.1      cl 
     97       1.1      cl /*
     98       1.1      cl  * Assembler stubs for hyper-calls.
     99       1.1      cl  */
    100       1.1      cl 
    101      1.10  bouyer static inline int
    102      1.10  bouyer HYPERVISOR_set_trap_table(trap_info_t *table)
    103       1.1      cl {
    104       1.1      cl     int ret;
    105      1.10  bouyer     unsigned long ign1;
    106      1.10  bouyer 
    107       1.1      cl     __asm__ __volatile__ (
    108       1.1      cl         TRAP_INSTR
    109      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    110      1.10  bouyer 	: "0" (__HYPERVISOR_set_trap_table), "1" (table)
    111      1.10  bouyer 	: "memory" );
    112       1.1      cl 
    113       1.1      cl     return ret;
    114       1.1      cl }
    115       1.1      cl 
    116      1.10  bouyer static inline int
    117      1.10  bouyer HYPERVISOR_mmu_update(mmu_update_t *req, int count, int *success_count)
    118       1.1      cl {
    119       1.1      cl     int ret;
    120      1.10  bouyer     unsigned long ign1, ign2, ign3;
    121      1.10  bouyer 
    122       1.1      cl     __asm__ __volatile__ (
    123       1.1      cl         TRAP_INSTR
    124      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    125      1.10  bouyer 	: "0" (__HYPERVISOR_mmu_update), "1" (req), "2" (count),
    126      1.10  bouyer 	  "3" (success_count)
    127      1.10  bouyer 	: "memory" );
    128      1.10  bouyer 
    129      1.10  bouyer     return ret;
    130      1.10  bouyer }
    131       1.1      cl 
    132      1.10  bouyer static inline int
    133      1.10  bouyer HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
    134      1.10  bouyer {
    135      1.10  bouyer     int ret;
    136      1.10  bouyer     unsigned long ign1, ign2;
    137      1.10  bouyer 
    138      1.10  bouyer     __asm__ __volatile__ (
    139      1.10  bouyer         TRAP_INSTR
    140      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    141      1.10  bouyer 	: "0" (__HYPERVISOR_set_gdt), "1" (frame_list), "2" (entries)
    142      1.10  bouyer 	: "memory" );
    143       1.2      cl 
    144       1.1      cl     return ret;
    145       1.1      cl }
    146       1.1      cl 
    147      1.10  bouyer static inline int
    148      1.10  bouyer HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
    149       1.7      cl {
    150       1.7      cl     int ret;
    151      1.10  bouyer     unsigned long ign1, ign2;
    152      1.10  bouyer 
    153       1.7      cl     __asm__ __volatile__ (
    154       1.7      cl         TRAP_INSTR
    155      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    156      1.10  bouyer 	: "0" (__HYPERVISOR_stack_switch), "1" (ss), "2" (esp)
    157      1.10  bouyer 	: "memory" );
    158       1.7      cl 
    159       1.7      cl     return ret;
    160       1.7      cl }
    161       1.7      cl 
    162      1.10  bouyer static inline int
    163      1.10  bouyer HYPERVISOR_set_callbacks(
    164      1.10  bouyer     unsigned long event_selector, unsigned long event_address,
    165      1.10  bouyer     unsigned long failsafe_selector, unsigned long failsafe_address)
    166       1.1      cl {
    167       1.1      cl     int ret;
    168      1.10  bouyer     unsigned long ign1, ign2, ign3, ign4;
    169      1.10  bouyer 
    170       1.1      cl     __asm__ __volatile__ (
    171       1.1      cl         TRAP_INSTR
    172      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    173      1.10  bouyer 	: "0" (__HYPERVISOR_set_callbacks), "1" (event_selector),
    174      1.10  bouyer 	  "2" (event_address), "3" (failsafe_selector), "4" (failsafe_address)
    175      1.10  bouyer 	: "memory" );
    176       1.1      cl 
    177      1.10  bouyer     return ret;
    178      1.10  bouyer }
    179      1.10  bouyer 
    180      1.10  bouyer static inline int
    181      1.10  bouyer HYPERVISOR_fpu_taskswitch(void)
    182      1.10  bouyer {
    183      1.10  bouyer     int ret;
    184      1.10  bouyer     __asm__ __volatile__ (
    185      1.10  bouyer         TRAP_INSTR
    186      1.10  bouyer         : "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) : "memory" );
    187       1.1      cl 
    188       1.1      cl     return ret;
    189       1.1      cl }
    190       1.1      cl 
    191      1.10  bouyer static inline int
    192      1.10  bouyer HYPERVISOR_yield(void)
    193       1.1      cl {
    194       1.1      cl     int ret;
    195      1.10  bouyer     unsigned long ign1;
    196      1.10  bouyer 
    197       1.1      cl     __asm__ __volatile__ (
    198       1.1      cl         TRAP_INSTR
    199      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    200      1.10  bouyer 	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_yield)
    201      1.10  bouyer 	: "memory" );
    202      1.10  bouyer 
    203      1.10  bouyer     return ret;
    204      1.10  bouyer }
    205      1.10  bouyer 
    206      1.10  bouyer static inline int
    207      1.10  bouyer HYPERVISOR_block(void)
    208      1.10  bouyer {
    209      1.10  bouyer     int ret;
    210      1.10  bouyer     unsigned long ign1;
    211       1.1      cl 
    212      1.10  bouyer     __asm__ __volatile__ (
    213      1.10  bouyer         TRAP_INSTR
    214      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    215      1.10  bouyer 	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_block)
    216      1.10  bouyer 	: "memory" );
    217       1.1      cl 
    218       1.1      cl     return ret;
    219       1.1      cl }
    220       1.1      cl 
    221      1.10  bouyer static inline int
    222      1.10  bouyer HYPERVISOR_shutdown(void)
    223       1.1      cl {
    224       1.1      cl     int ret;
    225      1.10  bouyer     unsigned long ign1;
    226      1.10  bouyer 
    227       1.1      cl     __asm__ __volatile__ (
    228       1.1      cl         TRAP_INSTR
    229      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    230      1.10  bouyer 	: "0" (__HYPERVISOR_sched_op),
    231      1.10  bouyer 	  "1" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
    232      1.10  bouyer         : "memory" );
    233       1.1      cl 
    234       1.1      cl     return ret;
    235       1.1      cl }
    236       1.1      cl 
    237      1.10  bouyer static inline int
    238      1.10  bouyer HYPERVISOR_reboot(void)
    239       1.1      cl {
    240       1.1      cl     int ret;
    241      1.10  bouyer     unsigned long ign1;
    242      1.10  bouyer 
    243       1.1      cl     __asm__ __volatile__ (
    244       1.1      cl         TRAP_INSTR
    245      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    246      1.10  bouyer 	: "0" (__HYPERVISOR_sched_op),
    247      1.10  bouyer 	  "1" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
    248      1.10  bouyer         : "memory" );
    249       1.1      cl 
    250       1.1      cl     return ret;
    251       1.1      cl }
    252       1.1      cl 
    253      1.10  bouyer static inline int
    254      1.10  bouyer HYPERVISOR_suspend(unsigned long srec)
    255       1.1      cl {
    256       1.1      cl     int ret;
    257      1.10  bouyer     unsigned long ign1, ign2;
    258      1.10  bouyer 
    259      1.10  bouyer     /* NB. On suspend, control software expects a suspend record in %esi. */
    260       1.1      cl     __asm__ __volatile__ (
    261       1.1      cl         TRAP_INSTR
    262      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=S" (ign2)
    263      1.10  bouyer 	: "0" (__HYPERVISOR_sched_op),
    264      1.10  bouyer         "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)),
    265      1.10  bouyer         "S" (srec) : "memory");
    266       1.1      cl 
    267       1.1      cl     return ret;
    268       1.1      cl }
    269       1.1      cl 
    270      1.10  bouyer static inline long
    271      1.10  bouyer HYPERVISOR_set_timer_op(uint64_t timeout)
    272       1.1      cl {
    273       1.1      cl     int ret;
    274      1.10  bouyer     unsigned long timeout_hi = (unsigned long)(timeout>>32);
    275      1.10  bouyer     unsigned long timeout_lo = (unsigned long)timeout;
    276      1.10  bouyer     unsigned long ign1, ign2;
    277      1.10  bouyer 
    278       1.1      cl     __asm__ __volatile__ (
    279       1.1      cl         TRAP_INSTR
    280      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    281      1.10  bouyer 	: "0" (__HYPERVISOR_set_timer_op), "b" (timeout_hi), "c" (timeout_lo)
    282      1.10  bouyer 	: "memory");
    283       1.1      cl 
    284       1.1      cl     return ret;
    285       1.1      cl }
    286       1.1      cl 
    287      1.10  bouyer static inline int
    288      1.10  bouyer HYPERVISOR_dom0_op(dom0_op_t *dom0_op)
    289       1.1      cl {
    290       1.1      cl     int ret;
    291      1.10  bouyer     unsigned long ign1;
    292      1.10  bouyer 
    293      1.10  bouyer     dom0_op->interface_version = DOM0_INTERFACE_VERSION;
    294       1.1      cl     __asm__ __volatile__ (
    295       1.1      cl         TRAP_INSTR
    296      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    297      1.10  bouyer 	: "0" (__HYPERVISOR_dom0_op), "1" (dom0_op)
    298      1.10  bouyer 	: "memory");
    299       1.1      cl 
    300       1.1      cl     return ret;
    301       1.1      cl }
    302       1.1      cl 
    303      1.10  bouyer static inline int
    304      1.10  bouyer HYPERVISOR_set_debugreg(int reg, unsigned long value)
    305       1.1      cl {
    306       1.1      cl     int ret;
    307      1.10  bouyer     unsigned long ign1, ign2;
    308      1.10  bouyer 
    309       1.1      cl     __asm__ __volatile__ (
    310       1.1      cl         TRAP_INSTR
    311      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    312      1.10  bouyer 	: "0" (__HYPERVISOR_set_debugreg), "1" (reg), "2" (value)
    313      1.10  bouyer 	: "memory" );
    314       1.1      cl 
    315       1.1      cl     return ret;
    316       1.1      cl }
    317       1.1      cl 
    318      1.10  bouyer static inline unsigned long
    319      1.10  bouyer HYPERVISOR_get_debugreg(int reg)
    320       1.1      cl {
    321      1.10  bouyer     unsigned long ret;
    322      1.10  bouyer     unsigned long ign1;
    323      1.10  bouyer 
    324       1.1      cl     __asm__ __volatile__ (
    325       1.1      cl         TRAP_INSTR
    326      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    327      1.10  bouyer 	: "0" (__HYPERVISOR_get_debugreg), "1" (reg)
    328      1.10  bouyer 	: "memory" );
    329       1.1      cl 
    330       1.1      cl     return ret;
    331       1.1      cl }
    332       1.1      cl 
    333      1.10  bouyer static inline int
    334      1.10  bouyer HYPERVISOR_update_descriptor(unsigned long pa, unsigned long word1,
    335      1.10  bouyer     unsigned long word2)
    336       1.1      cl {
    337       1.1      cl     int ret;
    338      1.10  bouyer     unsigned long ign1, ign2, ign3;
    339      1.10  bouyer 
    340       1.1      cl     __asm__ __volatile__ (
    341       1.1      cl         TRAP_INSTR
    342      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    343      1.10  bouyer 	: "0" (__HYPERVISOR_update_descriptor), "1" (pa), "2" (word1),
    344      1.10  bouyer 	  "3" (word2)
    345      1.10  bouyer 	: "memory" );
    346       1.1      cl 
    347       1.1      cl     return ret;
    348       1.1      cl }
    349       1.1      cl 
    350      1.10  bouyer static inline int
    351      1.10  bouyer HYPERVISOR_set_fast_trap(int idx)
    352       1.1      cl {
    353       1.1      cl     int ret;
    354      1.10  bouyer     unsigned long ign1;
    355      1.10  bouyer 
    356       1.1      cl     __asm__ __volatile__ (
    357       1.1      cl         TRAP_INSTR
    358      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    359      1.10  bouyer 	: "0" (__HYPERVISOR_set_fast_trap), "1" (idx)
    360      1.10  bouyer 	: "memory" );
    361       1.1      cl 
    362       1.1      cl     return ret;
    363       1.1      cl }
    364       1.1      cl 
    365      1.10  bouyer static inline int
    366      1.10  bouyer HYPERVISOR_dom_mem_op(unsigned int op, unsigned long *extent_list,
    367      1.10  bouyer     unsigned long nr_extents, unsigned int extent_order)
    368       1.1      cl {
    369       1.1      cl     int ret;
    370      1.10  bouyer     unsigned long ign1, ign2, ign3, ign4, ign5;
    371      1.10  bouyer 
    372       1.1      cl     __asm__ __volatile__ (
    373       1.1      cl         TRAP_INSTR
    374      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
    375      1.10  bouyer 	  "=D" (ign5)
    376      1.10  bouyer 	: "0" (__HYPERVISOR_dom_mem_op), "1" (op), "2" (extent_list),
    377      1.10  bouyer 	  "3" (nr_extents), "4" (extent_order), "5" (DOMID_SELF)
    378      1.10  bouyer         : "memory" );
    379       1.1      cl 
    380       1.1      cl     return ret;
    381       1.1      cl }
    382       1.1      cl 
    383      1.10  bouyer static inline int
    384      1.10  bouyer HYPERVISOR_multicall(void *call_list, int nr_calls)
    385       1.1      cl {
    386       1.1      cl     int ret;
    387      1.10  bouyer     unsigned long ign1, ign2;
    388      1.10  bouyer 
    389       1.1      cl     __asm__ __volatile__ (
    390       1.1      cl         TRAP_INSTR
    391      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    392      1.10  bouyer 	: "0" (__HYPERVISOR_multicall), "1" (call_list), "2" (nr_calls)
    393      1.10  bouyer 	: "memory" );
    394       1.1      cl 
    395       1.1      cl     return ret;
    396       1.1      cl }
    397       1.1      cl 
    398      1.10  bouyer static inline int
    399      1.10  bouyer HYPERVISOR_update_va_mapping(unsigned long page_nr, unsigned long new_val,
    400      1.10  bouyer     unsigned long flags)
    401       1.1      cl {
    402      1.10  bouyer     int ret;
    403      1.10  bouyer     unsigned long ign1, ign2, ign3;
    404      1.10  bouyer 
    405       1.1      cl     __asm__ __volatile__ (
    406       1.1      cl         TRAP_INSTR
    407      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    408      1.10  bouyer 	: "0" (__HYPERVISOR_update_va_mapping),
    409      1.10  bouyer           "1" (page_nr), "2" (new_val), "3" (flags)
    410      1.10  bouyer 	: "memory" );
    411      1.10  bouyer 
    412      1.10  bouyer #ifdef notdef
    413      1.10  bouyer     if (__predict_false(ret < 0))
    414      1.10  bouyer         panic("Failed update VA mapping: %08lx, %08lx, %08lx",
    415      1.10  bouyer               page_nr, new_val, flags);
    416      1.10  bouyer #endif
    417       1.1      cl 
    418       1.1      cl     return ret;
    419       1.1      cl }
    420       1.1      cl 
    421      1.10  bouyer static inline int
    422      1.10  bouyer HYPERVISOR_event_channel_op(void *op)
    423       1.1      cl {
    424       1.1      cl     int ret;
    425      1.10  bouyer     unsigned long ign1;
    426      1.10  bouyer 
    427       1.1      cl     __asm__ __volatile__ (
    428       1.1      cl         TRAP_INSTR
    429      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    430      1.10  bouyer 	: "0" (__HYPERVISOR_event_channel_op), "1" (op)
    431      1.10  bouyer 	: "memory" );
    432       1.1      cl 
    433       1.1      cl     return ret;
    434       1.1      cl }
    435       1.1      cl 
    436      1.10  bouyer static inline int
    437      1.10  bouyer HYPERVISOR_xen_version(int cmd)
    438       1.1      cl {
    439       1.1      cl     int ret;
    440      1.10  bouyer     unsigned long ign1;
    441      1.10  bouyer 
    442       1.1      cl     __asm__ __volatile__ (
    443       1.1      cl         TRAP_INSTR
    444      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    445      1.10  bouyer 	: "0" (__HYPERVISOR_xen_version), "1" (cmd)
    446      1.10  bouyer 	: "memory" );
    447       1.1      cl 
    448       1.1      cl     return ret;
    449       1.1      cl }
    450       1.1      cl 
    451      1.10  bouyer static inline int
    452      1.10  bouyer HYPERVISOR_console_io(int cmd, int count, char *str)
    453       1.1      cl {
    454       1.1      cl     int ret;
    455      1.10  bouyer     unsigned long ign1, ign2, ign3;
    456      1.10  bouyer 
    457       1.1      cl     __asm__ __volatile__ (
    458       1.1      cl         TRAP_INSTR
    459      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    460      1.10  bouyer 	: "0" (__HYPERVISOR_console_io), "1" (cmd), "2" (count), "3" (str)
    461      1.10  bouyer 	: "memory" );
    462       1.1      cl 
    463       1.1      cl     return ret;
    464       1.1      cl }
    465       1.1      cl 
    466      1.10  bouyer static inline int
    467      1.10  bouyer HYPERVISOR_physdev_op(void *physdev_op)
    468       1.1      cl {
    469       1.1      cl     int ret;
    470      1.10  bouyer     unsigned long ign1;
    471      1.10  bouyer 
    472       1.1      cl     __asm__ __volatile__ (
    473       1.1      cl         TRAP_INSTR
    474      1.10  bouyer         : "=a" (ret), "=b" (ign1)
    475      1.10  bouyer 	: "0" (__HYPERVISOR_physdev_op), "1" (physdev_op)
    476      1.10  bouyer 	: "memory" );
    477       1.1      cl 
    478       1.1      cl     return ret;
    479       1.1      cl }
    480       1.1      cl 
    481      1.10  bouyer static inline int
    482      1.10  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.10  bouyer     unsigned long ign1, ign2, ign3;
    486      1.10  bouyer 
    487       1.1      cl     __asm__ __volatile__ (
    488       1.1      cl         TRAP_INSTR
    489      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    490      1.10  bouyer 	: "0" (__HYPERVISOR_grant_table_op), "1" (cmd), "2" (count), "3" (uop)
    491      1.10  bouyer 	: "memory" );
    492       1.1      cl 
    493       1.1      cl     return ret;
    494       1.1      cl }
    495       1.1      cl 
    496      1.10  bouyer static inline int
    497      1.10  bouyer HYPERVISOR_update_va_mapping_otherdomain(unsigned long page_nr,
    498      1.10  bouyer     unsigned long new_val, unsigned long flags, domid_t domid)
    499       1.1      cl {
    500       1.1      cl     int ret;
    501      1.10  bouyer     unsigned long ign1, ign2, ign3, ign4;
    502      1.10  bouyer 
    503       1.1      cl     __asm__ __volatile__ (
    504       1.1      cl         TRAP_INSTR
    505      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    506      1.10  bouyer 	: "0" (__HYPERVISOR_update_va_mapping_otherdomain),
    507      1.10  bouyer           "1" (page_nr), "2" (new_val), "3" (flags), "4" (domid) :
    508      1.10  bouyer         "memory" );
    509      1.10  bouyer 
    510      1.10  bouyer     return ret;
    511      1.10  bouyer }
    512       1.1      cl 
    513      1.10  bouyer static inline int
    514      1.10  bouyer HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
    515      1.10  bouyer {
    516      1.10  bouyer     int ret;
    517      1.10  bouyer     unsigned long ign1, ign2;
    518      1.10  bouyer 
    519      1.10  bouyer     __asm__ __volatile__ (
    520      1.10  bouyer         TRAP_INSTR
    521      1.10  bouyer         : "=a" (ret), "=b" (ign1), "=c" (ign2)
    522      1.10  bouyer 	: "0" (__HYPERVISOR_vm_assist), "1" (cmd), "2" (type)
    523      1.10  bouyer 	: "memory" );
    524       1.2      cl 
    525       1.1      cl     return ret;
    526       1.1      cl }
    527       1.1      cl 
    528  1.10.2.5     riz /*
    529  1.10.2.5     riz  * Force a proper event-channel callback from Xen after clearing the
    530  1.10.2.5     riz  * callback mask. We do this in a very simple manner, by making a call
    531  1.10.2.5     riz  * down into Xen. The pending flag will be checked by Xen on return.
    532  1.10.2.5     riz  */
    533  1.10.2.5     riz static inline void hypervisor_force_callback(void)
    534  1.10.2.5     riz {
    535  1.10.2.5     riz 	(void)HYPERVISOR_xen_version(0);
    536  1.10.2.5     riz } __attribute__((no_instrument_function)) /* used by mcount */
    537  1.10.2.5     riz 
    538  1.10.2.5     riz static inline void
    539  1.10.2.5     riz hypervisor_notify_via_evtchn(unsigned int port)
    540  1.10.2.5     riz {
    541  1.10.2.5     riz 	evtchn_op_t op;
    542  1.10.2.5     riz 
    543  1.10.2.5     riz 	op.cmd = EVTCHNOP_send;
    544  1.10.2.5     riz 	op.u.send.local_port = port;
    545  1.10.2.5     riz 	(void)HYPERVISOR_event_channel_op(&op);
    546  1.10.2.5     riz }
    547  1.10.2.5     riz 
    548       1.1      cl #endif /* _XEN_HYPERVISOR_H_ */
    549