The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/xen/hypervisor.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /******************************************************************************
    2  * hypervisor.h
    3   * 
    4  * Linux-specific hypervisor handling.
    5  * 
    6  * Copyright (c) 2002, K A Fraser
    7  *
    8  * $FreeBSD: releng/12.0/sys/xen/hypervisor.h 289686 2015-10-21 10:44:07Z royger $
    9  */
   10 
   11 #ifndef __XEN_HYPERVISOR_H__
   12 #define __XEN_HYPERVISOR_H__
   13 
   14 #include <sys/cdefs.h>
   15 #include <sys/systm.h>
   16 #include <xen/interface/xen.h>
   17 #include <xen/interface/platform.h>
   18 #include <xen/interface/event_channel.h>
   19 #include <xen/interface/physdev.h>
   20 #include <xen/interface/sched.h>
   21 #include <xen/interface/callback.h>
   22 #include <xen/interface/memory.h>
   23 #include <machine/xen/hypercall.h>
   24 
   25 extern uint64_t get_system_time(int ticks);
   26 
   27 static inline int 
   28 HYPERVISOR_console_write(const char *str, int count)
   29 {
   30     return HYPERVISOR_console_io(CONSOLEIO_write, count, str); 
   31 }
   32 
   33 static inline int
   34 HYPERVISOR_yield(void)
   35 {
   36         int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
   37 
   38 #if CONFIG_XEN_COMPAT <= 0x030002
   39         if (rc == -ENOXENSYS)
   40                 rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
   41 #endif
   42         return (rc);
   43 }
   44 
   45 static inline int
   46 HYPERVISOR_block(
   47         void)
   48 {
   49         int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
   50 
   51 #if CONFIG_XEN_COMPAT <= 0x030002
   52         if (rc == -ENOXENSYS)
   53                 rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
   54 #endif
   55         return (rc);
   56 }
   57 
   58 
   59 static inline void 
   60 HYPERVISOR_shutdown(unsigned int reason)
   61 {
   62         struct sched_shutdown sched_shutdown = {
   63                 .reason = reason
   64         };
   65 
   66         HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
   67 #if CONFIG_XEN_COMPAT <= 0x030002
   68         HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
   69 #endif
   70 }
   71 
   72 static inline void
   73 HYPERVISOR_crash(void) 
   74 {
   75         HYPERVISOR_shutdown(SHUTDOWN_crash); 
   76         /* NEVER REACHED */
   77         for (;;) ; /* eliminate noreturn error */ 
   78 }
   79 
   80 /* Transfer control to hypervisor until an event is detected on one */
   81 /* of the specified ports or the specified number of ticks elapse */
   82 static inline int
   83 HYPERVISOR_poll(
   84         evtchn_port_t *ports, unsigned int nr_ports, int ticks)
   85 {
   86         int rc;
   87         struct sched_poll sched_poll = {
   88                 .nr_ports = nr_ports,
   89                 .timeout = get_system_time(ticks)
   90         };
   91         set_xen_guest_handle(sched_poll.ports, ports);
   92 
   93         rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
   94 #if CONFIG_XEN_COMPAT <= 0x030002
   95         if (rc == -ENOXENSYS)
   96                 rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
   97 #endif  
   98         return (rc);
   99 }
  100 
  101 #endif /* __XEN_HYPERVISOR_H__ */

Cache object: b04481a2203257ae4955605509bcf061


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.