2008-08-12 19:41:11 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* hypervisor.h
|
|
|
|
*
|
|
|
|
* Linux-specific hypervisor handling.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2002, K A Fraser
|
2008-12-29 06:31:03 +00:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
2008-08-12 19:41:11 +00:00
|
|
|
*/
|
|
|
|
|
2009-03-11 15:30:12 +00:00
|
|
|
#ifndef __XEN_HYPERVISOR_H__
|
|
|
|
#define __XEN_HYPERVISOR_H__
|
|
|
|
|
2008-08-12 19:41:11 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <sys/systm.h>
|
2021-10-13 02:00:26 +00:00
|
|
|
#include <contrib/xen/xen.h>
|
|
|
|
#include <contrib/xen/platform.h>
|
|
|
|
#include <contrib/xen/event_channel.h>
|
|
|
|
#include <contrib/xen/physdev.h>
|
|
|
|
#include <contrib/xen/sched.h>
|
|
|
|
#include <contrib/xen/callback.h>
|
|
|
|
#include <contrib/xen/memory.h>
|
|
|
|
#include <contrib/xen/hvm/dm_op.h>
|
2008-08-12 19:41:11 +00:00
|
|
|
#include <machine/xen/hypercall.h>
|
|
|
|
|
|
|
|
static inline int
|
2015-10-08 16:39:43 +00:00
|
|
|
HYPERVISOR_console_write(const char *str, int count)
|
2008-08-12 19:41:11 +00:00
|
|
|
{
|
|
|
|
return HYPERVISOR_console_io(CONSOLEIO_write, count, str);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
HYPERVISOR_yield(void)
|
|
|
|
{
|
|
|
|
int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
|
|
|
|
|
|
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
|
|
|
if (rc == -ENOXENSYS)
|
|
|
|
rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
|
|
|
|
#endif
|
|
|
|
return (rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
HYPERVISOR_shutdown(unsigned int reason)
|
|
|
|
{
|
|
|
|
struct sched_shutdown sched_shutdown = {
|
|
|
|
.reason = reason
|
|
|
|
};
|
|
|
|
|
|
|
|
HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
|
|
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
|
|
|
HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-03-11 15:30:12 +00:00
|
|
|
#endif /* __XEN_HYPERVISOR_H__ */
|