1221828Sgrehan/*-
2221828Sgrehan * Copyright (c) 2011 NetApp, Inc.
3221828Sgrehan * All rights reserved.
4221828Sgrehan *
5221828Sgrehan * Redistribution and use in source and binary forms, with or without
6221828Sgrehan * modification, are permitted provided that the following conditions
7221828Sgrehan * are met:
8221828Sgrehan * 1. Redistributions of source code must retain the above copyright
9221828Sgrehan *    notice, this list of conditions and the following disclaimer.
10221828Sgrehan * 2. Redistributions in binary form must reproduce the above copyright
11221828Sgrehan *    notice, this list of conditions and the following disclaimer in the
12221828Sgrehan *    documentation and/or other materials provided with the distribution.
13221828Sgrehan *
14221828Sgrehan * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15221828Sgrehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16221828Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17221828Sgrehan * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18221828Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19221828Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20221828Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21221828Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22221828Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23221828Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24221828Sgrehan * SUCH DAMAGE.
25221828Sgrehan *
26221828Sgrehan * $FreeBSD$
27221828Sgrehan */
28221828Sgrehan
29221828Sgrehan#ifndef	_FBSDRUN_H_
30221828Sgrehan#define	_FBSDRUN_H_
31221828Sgrehan
32221828Sgrehan#ifndef CTASSERT		/* Allow lint to override */
33221828Sgrehan#define	CTASSERT(x)		_CTASSERT(x, __LINE__)
34221828Sgrehan#define	_CTASSERT(x, y)		__CTASSERT(x, y)
35221828Sgrehan#define	__CTASSERT(x, y)	typedef char __assert ## y[(x) ? 1 : -1]
36221828Sgrehan#endif
37221828Sgrehan
38270159Sgrehan#define	VMEXIT_CONTINUE		1	/* continue from next instruction */
39270159Sgrehan#define	VMEXIT_RESTART		2	/* restart current instruction */
40270159Sgrehan#define	VMEXIT_ABORT		3	/* abort the vm run loop */
41270159Sgrehan
42221828Sgrehanstruct vmctx;
43221828Sgrehanextern int guest_ncpus;
44267450Sjhbextern char *guest_uuid_str;
45221828Sgrehanextern char *vmname;
46221828Sgrehan
47248477Sneelvoid *paddr_guest2host(struct vmctx *ctx, uintptr_t addr, size_t len);
48221828Sgrehan
49256869Sneelvoid fbsdrun_set_capabilities(struct vmctx *ctx, int cpu);
50268894Sjhbvoid fbsdrun_addcpu(struct vmctx *ctx, int fromcpu, int newcpu, uint64_t rip);
51221828Sgrehanint  fbsdrun_muxed(void);
52221828Sgrehanint  fbsdrun_vmexit_on_hlt(void);
53221828Sgrehanint  fbsdrun_vmexit_on_pause(void);
54240943Sneelint  fbsdrun_disable_x2apic(void);
55256755Sgrehanint  fbsdrun_virtio_msix(void);
56221828Sgrehan#endif
57