xref: /freebsd/sys/xen/hypervisor.h (revision 4d846d26)
1 /******************************************************************************
2  * hypervisor.h
3   *
4  * Linux-specific hypervisor handling.
5  *
6  * Copyright (c) 2002, K A Fraser
7  *
8  * $FreeBSD$
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 <contrib/xen/xen.h>
17 #include <contrib/xen/platform.h>
18 #include <contrib/xen/event_channel.h>
19 #include <contrib/xen/physdev.h>
20 #include <contrib/xen/sched.h>
21 #include <contrib/xen/callback.h>
22 #include <contrib/xen/memory.h>
23 #include <contrib/xen/hvm/dm_op.h>
24 #include <machine/xen/hypercall.h>
25 
26 static inline int
27 HYPERVISOR_console_write(const char *str, int count)
28 {
29     return HYPERVISOR_console_io(CONSOLEIO_write, count, str);
30 }
31 
32 static inline int
33 HYPERVISOR_yield(void)
34 {
35 
36 	return (HYPERVISOR_sched_op(SCHEDOP_yield, NULL));
37 }
38 
39 static inline void
40 HYPERVISOR_shutdown(unsigned int reason)
41 {
42 	struct sched_shutdown sched_shutdown = {
43 		.reason = reason
44 	};
45 
46 	HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
47 }
48 
49 #endif /* __XEN_HYPERVISOR_H__ */
50