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