xref: /freebsd/lib/libvmmapi/vmmapi.h (revision 99127fd103624de593c7d1d885387e7d3667d73d)
1366f6083SPeter Grehan /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
35e53a4f9SPedro F. Giffuni  *
4366f6083SPeter Grehan  * Copyright (c) 2011 NetApp, Inc.
5366f6083SPeter Grehan  * All rights reserved.
6366f6083SPeter Grehan  *
7366f6083SPeter Grehan  * Redistribution and use in source and binary forms, with or without
8366f6083SPeter Grehan  * modification, are permitted provided that the following conditions
9366f6083SPeter Grehan  * are met:
10366f6083SPeter Grehan  * 1. Redistributions of source code must retain the above copyright
11366f6083SPeter Grehan  *    notice, this list of conditions and the following disclaimer.
12366f6083SPeter Grehan  * 2. Redistributions in binary form must reproduce the above copyright
13366f6083SPeter Grehan  *    notice, this list of conditions and the following disclaimer in the
14366f6083SPeter Grehan  *    documentation and/or other materials provided with the distribution.
15366f6083SPeter Grehan  *
16366f6083SPeter Grehan  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
17366f6083SPeter Grehan  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18366f6083SPeter Grehan  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19366f6083SPeter Grehan  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
20366f6083SPeter Grehan  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21366f6083SPeter Grehan  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22366f6083SPeter Grehan  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23366f6083SPeter Grehan  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24366f6083SPeter Grehan  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25366f6083SPeter Grehan  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26366f6083SPeter Grehan  * SUCH DAMAGE.
27366f6083SPeter Grehan  */
28366f6083SPeter Grehan 
29366f6083SPeter Grehan #ifndef _VMMAPI_H_
30366f6083SPeter Grehan #define	_VMMAPI_H_
31366f6083SPeter Grehan 
3295ebc360SNeel Natu #include <sys/param.h>
3395ebc360SNeel Natu #include <sys/cpuset.h>
34f0880ab7SVitaliy Gusev #include <machine/vmm.h>
35483d953aSJohn Baldwin #include <machine/vmm_dev.h>
3695ebc360SNeel Natu 
378a68ae80SConrad Meyer #include <stdbool.h>
388a68ae80SConrad Meyer 
39d087a399SNeel Natu /*
40d087a399SNeel Natu  * API version for out-of-tree consumers like grub-bhyve for making compile
41d087a399SNeel Natu  * time decisions.
42d087a399SNeel Natu  */
437d9ef309SJohn Baldwin #define	VMMAPI_VERSION	0200	/* 2 digit major followed by 2 digit minor */
44d087a399SNeel Natu 
456303b65dSNeel Natu struct iovec;
467d9ef309SJohn Baldwin struct vcpu;
47366f6083SPeter Grehan struct vmctx;
48483d953aSJohn Baldwin struct vm_snapshot_meta;
49e9027382SNeel Natu enum x2apic_state;
50366f6083SPeter Grehan 
51b060ba50SNeel Natu /*
52b060ba50SNeel Natu  * Different styles of mapping the memory assigned to a VM into the address
53b060ba50SNeel Natu  * space of the controlling process.
54b060ba50SNeel Natu  */
55b060ba50SNeel Natu enum vm_mmap_style {
56b060ba50SNeel Natu 	VM_MMAP_NONE,		/* no mapping */
57b060ba50SNeel Natu 	VM_MMAP_ALL,		/* fully and statically mapped */
58b060ba50SNeel Natu 	VM_MMAP_SPARSE,		/* mappings created on-demand */
59b060ba50SNeel Natu };
60b060ba50SNeel Natu 
619b1aa8d6SNeel Natu /*
629b1aa8d6SNeel Natu  * 'flags' value passed to 'vm_set_memflags()'.
639b1aa8d6SNeel Natu  */
640dd10c00SNeel Natu #define	VM_MEM_F_INCORE	0x01	/* include guest memory in core file */
659b1aa8d6SNeel Natu #define	VM_MEM_F_WIRED	0x02	/* guest memory is wired */
669b1aa8d6SNeel Natu 
679b1aa8d6SNeel Natu /*
689b1aa8d6SNeel Natu  * Identifiers for memory segments:
699b1aa8d6SNeel Natu  * - vm_setup_memory() uses VM_SYSMEM for the system memory segment.
709b1aa8d6SNeel Natu  * - the remaining identifiers can be used to create devmem segments.
719b1aa8d6SNeel Natu  */
729b1aa8d6SNeel Natu enum {
739b1aa8d6SNeel Natu 	VM_SYSMEM,
749b1aa8d6SNeel Natu 	VM_BOOTROM,
759b1aa8d6SNeel Natu 	VM_FRAMEBUFFER,
76e47fe318SCorvin Köhne 	VM_PCIROM,
779b1aa8d6SNeel Natu };
789b1aa8d6SNeel Natu 
791228a047SVitaliy Gusev __BEGIN_DECLS
809b1aa8d6SNeel Natu /*
819b1aa8d6SNeel Natu  * Get the length and name of the memory segment identified by 'segid'.
829b1aa8d6SNeel Natu  * Note that system memory segments are identified with a nul name.
839b1aa8d6SNeel Natu  *
849b1aa8d6SNeel Natu  * Returns 0 on success and non-zero otherwise.
859b1aa8d6SNeel Natu  */
869b1aa8d6SNeel Natu int	vm_get_memseg(struct vmctx *ctx, int ident, size_t *lenp, char *name,
879b1aa8d6SNeel Natu 	    size_t namesiz);
889b1aa8d6SNeel Natu 
899b1aa8d6SNeel Natu /*
909b1aa8d6SNeel Natu  * Iterate over the guest address space. This function finds an address range
919b1aa8d6SNeel Natu  * that starts at an address >= *gpa.
929b1aa8d6SNeel Natu  *
939b1aa8d6SNeel Natu  * Returns 0 if the next address range was found and non-zero otherwise.
949b1aa8d6SNeel Natu  */
959b1aa8d6SNeel Natu int	vm_mmap_getnext(struct vmctx *ctx, vm_paddr_t *gpa, int *segid,
969b1aa8d6SNeel Natu 	    vm_ooffset_t *segoff, size_t *len, int *prot, int *flags);
97483d953aSJohn Baldwin 
98483d953aSJohn Baldwin int	vm_get_guestmem_from_ctx(struct vmctx *ctx, char **guest_baseaddr,
99483d953aSJohn Baldwin 				 size_t *lowmem_size, size_t *highmem_size);
100483d953aSJohn Baldwin 
1019b1aa8d6SNeel Natu /*
1029b1aa8d6SNeel Natu  * Create a device memory segment identified by 'segid'.
1039b1aa8d6SNeel Natu  *
1049b1aa8d6SNeel Natu  * Returns a pointer to the memory segment on success and MAP_FAILED otherwise.
1059b1aa8d6SNeel Natu  */
1069b1aa8d6SNeel Natu void	*vm_create_devmem(struct vmctx *ctx, int segid, const char *name,
1079b1aa8d6SNeel Natu 	    size_t len);
1089b1aa8d6SNeel Natu 
1099b1aa8d6SNeel Natu /*
1109b1aa8d6SNeel Natu  * Map the memory segment identified by 'segid' into the guest address space
1119b1aa8d6SNeel Natu  * at [gpa,gpa+len) with protection 'prot'.
1129b1aa8d6SNeel Natu  */
1139b1aa8d6SNeel Natu int	vm_mmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, int segid,
1149b1aa8d6SNeel Natu 	    vm_ooffset_t segoff, size_t len, int prot);
1150dd10c00SNeel Natu 
116f8a6ec2dSD Scott Phillips int	vm_munmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, size_t len);
117f8a6ec2dSD Scott Phillips 
118366f6083SPeter Grehan int	vm_create(const char *name);
119366f6083SPeter Grehan struct vmctx *vm_open(const char *name);
120*99127fd1SMark Johnston #define	VMMAPI_OPEN_CREATE	0x01	/* create if the VM does not exist */
121*99127fd1SMark Johnston #define	VMMAPI_OPEN_REINIT	0x02	/* reinitialize the VM if it exists */
122*99127fd1SMark Johnston struct vmctx *vm_openf(const char *name, int flags);
123f0880ab7SVitaliy Gusev void	vm_close(struct vmctx *ctx);
124366f6083SPeter Grehan void	vm_destroy(struct vmctx *ctx);
1253e9b4532SMark Johnston int	vm_limit_rights(struct vmctx *ctx);
1267d9ef309SJohn Baldwin struct vcpu *vm_vcpu_open(struct vmctx *ctx, int vcpuid);
1277d9ef309SJohn Baldwin void	vm_vcpu_close(struct vcpu *vcpu);
1287d9ef309SJohn Baldwin int	vcpu_id(struct vcpu *vcpu);
129200758f1SNeel Natu int	vm_parse_memsize(const char *optarg, size_t *memsize);
130b060ba50SNeel Natu int	vm_setup_memory(struct vmctx *ctx, size_t len, enum vm_mmap_style s);
131b060ba50SNeel Natu void	*vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len);
132483d953aSJohn Baldwin /* inverse operation to vm_map_gpa - extract guest address from host pointer */
133483d953aSJohn Baldwin vm_paddr_t vm_rev_map_gpa(struct vmctx *ctx, void *addr);
13456a26fc1SMark Johnston #ifdef __amd64__
135318224bbSNeel Natu int	vm_get_gpa_pmap(struct vmctx *, uint64_t gpa, uint64_t *pte, int *num);
1367d9ef309SJohn Baldwin int	vm_gla2gpa(struct vcpu *vcpu, struct vm_guest_paging *paging,
1379c4d5478SNeel Natu 		   uint64_t gla, int prot, uint64_t *gpa, int *fault);
13856a26fc1SMark Johnston #endif
1397d9ef309SJohn Baldwin int	vm_gla2gpa_nofault(struct vcpu *vcpu,
1405f8754c0SJohn Baldwin 		   struct vm_guest_paging *paging, uint64_t gla, int prot,
1415f8754c0SJohn Baldwin 		   uint64_t *gpa, int *fault);
142b060ba50SNeel Natu uint32_t vm_get_lowmem_limit(struct vmctx *ctx);
1430dd10c00SNeel Natu void	vm_set_memflags(struct vmctx *ctx, int flags);
1449b1aa8d6SNeel Natu int	vm_get_memflags(struct vmctx *ctx);
1453efc45f3SRobert Wing const char *vm_get_name(struct vmctx *ctx);
146be679db4SNeel Natu size_t	vm_get_lowmem_size(struct vmctx *ctx);
1477e0fa794SMark Johnston vm_paddr_t vm_get_highmem_base(struct vmctx *ctx);
148be679db4SNeel Natu size_t	vm_get_highmem_size(struct vmctx *ctx);
149e4656e10SMark Johnston #ifdef __amd64__
1507d9ef309SJohn Baldwin int	vm_set_desc(struct vcpu *vcpu, int reg,
151366f6083SPeter Grehan 		    uint64_t base, uint32_t limit, uint32_t access);
1527d9ef309SJohn Baldwin int	vm_get_desc(struct vcpu *vcpu, int reg,
153366f6083SPeter Grehan 		    uint64_t *base, uint32_t *limit, uint32_t *access);
1547d9ef309SJohn Baldwin int	vm_get_seg_desc(struct vcpu *vcpu, int reg, struct seg_desc *seg_desc);
155e4656e10SMark Johnston #endif
1567d9ef309SJohn Baldwin int	vm_set_register(struct vcpu *vcpu, int reg, uint64_t val);
1577d9ef309SJohn Baldwin int	vm_get_register(struct vcpu *vcpu, int reg, uint64_t *retval);
1587d9ef309SJohn Baldwin int	vm_set_register_set(struct vcpu *vcpu, unsigned int count,
1594f866698SJohn Baldwin     const int *regnums, uint64_t *regvals);
1607d9ef309SJohn Baldwin int	vm_get_register_set(struct vcpu *vcpu, unsigned int count,
1614f866698SJohn Baldwin     const int *regnums, uint64_t *regvals);
162e17eca32SMark Johnston int	vm_run(struct vcpu *vcpu, struct vm_run *vmrun);
163f0fdcfe2SNeel Natu int	vm_suspend(struct vmctx *ctx, enum vm_suspend_how how);
1645fcf252fSNeel Natu int	vm_reinit(struct vmctx *ctx);
1651855002dSMark Johnston int	vm_raise_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg,
1661855002dSMark Johnston     int bus, int slot, int func);
1677ab1a32cSRuslan Bukin #if defined(__aarch64__)
1685ec6c300SMark Johnston int	vm_attach_vgic(struct vmctx *ctx, uint64_t dist_start, size_t dist_size,
1695ec6c300SMark Johnston     uint64_t redist_start, size_t redist_size);
1707ab1a32cSRuslan Bukin int	vm_inject_exception(struct vcpu *vcpu, uint64_t esr, uint64_t far);
1717ab1a32cSRuslan Bukin #elif defined(__riscv)
1727ab1a32cSRuslan Bukin int	vm_attach_aplic(struct vmctx *ctx, uint64_t mem_start, size_t mem_size);
1737ab1a32cSRuslan Bukin int	vm_inject_exception(struct vcpu *vcpu, uint64_t scause);
1747ab1a32cSRuslan Bukin #endif
1757ab1a32cSRuslan Bukin #if defined(__aarch64__) || defined(__riscv)
1765ec6c300SMark Johnston int	vm_assert_irq(struct vmctx *ctx, uint32_t irq);
1775ec6c300SMark Johnston int	vm_deassert_irq(struct vmctx *ctx, uint32_t irq);
1785ec6c300SMark Johnston #endif
1793170dcaeSMark Johnston #ifdef __amd64__
1801855002dSMark Johnston int	vm_apicid2vcpu(struct vmctx *ctx, int apicid);
1817d9ef309SJohn Baldwin int	vm_inject_exception(struct vcpu *vcpu, int vector,
182d087a399SNeel Natu     int errcode_valid, uint32_t errcode, int restart_instruction);
1837d9ef309SJohn Baldwin int	vm_lapic_irq(struct vcpu *vcpu, int vector);
1847d9ef309SJohn Baldwin int	vm_lapic_local_irq(struct vcpu *vcpu, int vector);
1854f8be175SNeel Natu int	vm_lapic_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg);
186565bbb86SNeel Natu int	vm_ioapic_assert_irq(struct vmctx *ctx, int irq);
187565bbb86SNeel Natu int	vm_ioapic_deassert_irq(struct vmctx *ctx, int irq);
188ac7304a7SNeel Natu int	vm_ioapic_pulse_irq(struct vmctx *ctx, int irq);
1893cbf3585SJohn Baldwin int	vm_ioapic_pincount(struct vmctx *ctx, int *pincount);
190b96be57aSTycho Nightingale int	vm_isa_assert_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq);
191762fd208STycho Nightingale int	vm_isa_deassert_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq);
192762fd208STycho Nightingale int	vm_isa_pulse_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq);
193b3e9732aSJohn Baldwin int	vm_isa_set_irq_trigger(struct vmctx *ctx, int atpic_irq,
194b3e9732aSJohn Baldwin 	    enum vm_intr_trigger trigger);
1957d9ef309SJohn Baldwin int	vm_inject_nmi(struct vcpu *vcpu);
196e4656e10SMark Johnston int	vm_readwrite_kernemu_device(struct vcpu *vcpu,
197e4656e10SMark Johnston 	    vm_paddr_t gpa, bool write, int size, uint64_t *value);
1983170dcaeSMark Johnston #endif
199366f6083SPeter Grehan int	vm_capability_name2type(const char *capname);
20013f4cf6cSNeel Natu const char *vm_capability_type2name(int type);
2017d9ef309SJohn Baldwin int	vm_get_capability(struct vcpu *vcpu, enum vm_cap_type cap,
202366f6083SPeter Grehan 			  int *retval);
2037d9ef309SJohn Baldwin int	vm_set_capability(struct vcpu *vcpu, enum vm_cap_type cap,
204366f6083SPeter Grehan 			  int val);
205366f6083SPeter Grehan int	vm_assign_pptdev(struct vmctx *ctx, int bus, int slot, int func);
206366f6083SPeter Grehan int	vm_unassign_pptdev(struct vmctx *ctx, int bus, int slot, int func);
207366f6083SPeter Grehan int	vm_map_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
208366f6083SPeter Grehan 			   vm_paddr_t gpa, size_t len, vm_paddr_t hpa);
209f8a6ec2dSD Scott Phillips int	vm_unmap_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
210f8a6ec2dSD Scott Phillips 			     vm_paddr_t gpa, size_t len);
2117d9ef309SJohn Baldwin int	vm_setup_pptdev_msi(struct vmctx *ctx, int bus, int slot,
21255888cfaSNeel Natu 	    int func, uint64_t addr, uint64_t msg, int numvec);
2137d9ef309SJohn Baldwin int	vm_setup_pptdev_msix(struct vmctx *ctx, int bus, int slot,
21455888cfaSNeel Natu 	    int func, int idx, uint64_t addr, uint64_t msg,
21555888cfaSNeel Natu 	    uint32_t vector_control);
2161925586eSJohn Baldwin int	vm_disable_pptdev_msix(struct vmctx *ctx, int bus, int slot, int func);
217366f6083SPeter Grehan 
2187d9ef309SJohn Baldwin int	vm_get_intinfo(struct vcpu *vcpu, uint64_t *i1, uint64_t *i2);
2197d9ef309SJohn Baldwin int	vm_set_intinfo(struct vcpu *vcpu, uint64_t exit_intinfo);
220091d4532SNeel Natu 
221366f6083SPeter Grehan /*
222366f6083SPeter Grehan  * Return a pointer to the statistics buffer. Note that this is not MT-safe.
223366f6083SPeter Grehan  */
2247d9ef309SJohn Baldwin uint64_t *vm_get_stats(struct vcpu *vcpu, struct timeval *ret_tv,
225366f6083SPeter Grehan 		       int *ret_entries);
226366f6083SPeter Grehan const char *vm_get_stat_desc(struct vmctx *ctx, int index);
227366f6083SPeter Grehan 
2283170dcaeSMark Johnston #ifdef __amd64__
2297d9ef309SJohn Baldwin int	vm_get_x2apic_state(struct vcpu *vcpu, enum x2apic_state *s);
2307d9ef309SJohn Baldwin int	vm_set_x2apic_state(struct vcpu *vcpu, enum x2apic_state s);
231e9027382SNeel Natu 
23208e3ff32SNeel Natu int	vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities);
23308e3ff32SNeel Natu 
2346303b65dSNeel Natu /*
2356303b65dSNeel Natu  * Translate the GLA range [gla,gla+len) into GPA segments in 'iov'.
23675f46cf6SPedro F. Giffuni  * The 'iovcnt' should be big enough to accommodate all GPA segments.
2379c4d5478SNeel Natu  *
2389c4d5478SNeel Natu  * retval	fault		Interpretation
2399c4d5478SNeel Natu  *   0		  0		Success
2409c4d5478SNeel Natu  *   0		  1		An exception was injected into the guest
2419c4d5478SNeel Natu  * EFAULT	 N/A		Error
2426303b65dSNeel Natu  */
2437d9ef309SJohn Baldwin int	vm_copy_setup(struct vcpu *vcpu, struct vm_guest_paging *pg,
2449c4d5478SNeel Natu 	    uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt,
2459c4d5478SNeel Natu 	    int *fault);
24656a26fc1SMark Johnston #endif
2472b4fe856SJohn Baldwin void	vm_copyin(struct iovec *guest_iov, void *host_dst, size_t len);
2482b4fe856SJohn Baldwin void	vm_copyout(const void *host_src, struct iovec *guest_iov, size_t len);
2492b4fe856SJohn Baldwin void	vm_copy_teardown(struct iovec *iov, int iovcnt);
250da11f4aaSNeel Natu 
2513170dcaeSMark Johnston #ifdef __amd64__
2520dafa5cdSNeel Natu /* RTC */
2530dafa5cdSNeel Natu int	vm_rtc_write(struct vmctx *ctx, int offset, uint8_t value);
2540dafa5cdSNeel Natu int	vm_rtc_read(struct vmctx *ctx, int offset, uint8_t *retval);
2550dafa5cdSNeel Natu int	vm_rtc_settime(struct vmctx *ctx, time_t secs);
2560dafa5cdSNeel Natu int	vm_rtc_gettime(struct vmctx *ctx, time_t *secs);
2573170dcaeSMark Johnston #endif
2580dafa5cdSNeel Natu 
259366f6083SPeter Grehan /* Reset vcpu register state */
2607d9ef309SJohn Baldwin int	vcpu_reset(struct vcpu *vcpu);
261366f6083SPeter Grehan 
26295ebc360SNeel Natu int	vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus);
26395ebc360SNeel Natu int	vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus);
264fc276d92SJohn Baldwin int	vm_debug_cpus(struct vmctx *ctx, cpuset_t *cpus);
2657d9ef309SJohn Baldwin int	vm_activate_cpu(struct vcpu *vcpu);
2667d9ef309SJohn Baldwin int	vm_suspend_all_cpus(struct vmctx *ctx);
2677d9ef309SJohn Baldwin int	vm_suspend_cpu(struct vcpu *vcpu);
2687d9ef309SJohn Baldwin int	vm_resume_all_cpus(struct vmctx *ctx);
2697d9ef309SJohn Baldwin int	vm_resume_cpu(struct vcpu *vcpu);
2707d9ef309SJohn Baldwin int	vm_restart_instruction(struct vcpu *vcpu);
27195ebc360SNeel Natu 
27201d822d3SRodney W. Grimes /* CPU topology */
27301d822d3SRodney W. Grimes int	vm_set_topology(struct vmctx *ctx, uint16_t sockets, uint16_t cores,
27401d822d3SRodney W. Grimes 	    uint16_t threads, uint16_t maxcpus);
27501d822d3SRodney W. Grimes int	vm_get_topology(struct vmctx *ctx, uint16_t *sockets, uint16_t *cores,
27601d822d3SRodney W. Grimes 	    uint16_t *threads, uint16_t *maxcpus);
27701d822d3SRodney W. Grimes 
278366f6083SPeter Grehan /*
279366f6083SPeter Grehan  * FreeBSD specific APIs
280366f6083SPeter Grehan  */
2817d9ef309SJohn Baldwin int	vm_setup_freebsd_registers(struct vcpu *vcpu,
282366f6083SPeter Grehan 				uint64_t rip, uint64_t cr3, uint64_t gdtbase,
283366f6083SPeter Grehan 				uint64_t rsp);
2847d9ef309SJohn Baldwin int	vm_setup_freebsd_registers_i386(struct vcpu *vcpu,
28500f3efe1SJohn Baldwin 					uint32_t eip, uint32_t gdtbase,
28600f3efe1SJohn Baldwin 					uint32_t esp);
287366f6083SPeter Grehan void	vm_setup_freebsd_gdt(uint64_t *gdtr);
288483d953aSJohn Baldwin 
289483d953aSJohn Baldwin /*
290483d953aSJohn Baldwin  * Save and restore
291483d953aSJohn Baldwin  */
2920f735657SJohn Baldwin int	vm_snapshot_req(struct vmctx *ctx, struct vm_snapshot_meta *meta);
293483d953aSJohn Baldwin int	vm_restore_time(struct vmctx *ctx);
2943e9b4532SMark Johnston 
2953e9b4532SMark Johnston /*
2963e9b4532SMark Johnston  * Deprecated interfaces, do not use them in new code.
2973e9b4532SMark Johnston  */
2983e9b4532SMark Johnston int	vm_get_device_fd(struct vmctx *ctx);
2993e9b4532SMark Johnston const cap_ioctl_t *vm_get_ioctls(size_t *len);
3003e9b4532SMark Johnston 
3011228a047SVitaliy Gusev __END_DECLS
302483d953aSJohn Baldwin 
303366f6083SPeter Grehan #endif	/* _VMMAPI_H_ */
304