xref: /netbsd-src/sys/external/bsd/common/include/asm/vmware.h (revision a19ec08765492355d530fee1f5fa01ac2b1e4a4a)
1*a19ec087Sriastradh /*	$NetBSD: vmware.h,v 1.1 2022/10/25 23:39:01 riastradh Exp $	*/
2*a19ec087Sriastradh 
3*a19ec087Sriastradh /*-
4*a19ec087Sriastradh  * Copyright (c) 2022 The NetBSD Foundation, Inc.
5*a19ec087Sriastradh  * All rights reserved.
6*a19ec087Sriastradh  *
7*a19ec087Sriastradh  * Redistribution and use in source and binary forms, with or without
8*a19ec087Sriastradh  * modification, are permitted provided that the following conditions
9*a19ec087Sriastradh  * are met:
10*a19ec087Sriastradh  * 1. Redistributions of source code must retain the above copyright
11*a19ec087Sriastradh  *    notice, this list of conditions and the following disclaimer.
12*a19ec087Sriastradh  * 2. Redistributions in binary form must reproduce the above copyright
13*a19ec087Sriastradh  *    notice, this list of conditions and the following disclaimer in the
14*a19ec087Sriastradh  *    documentation and/or other materials provided with the distribution.
15*a19ec087Sriastradh  *
16*a19ec087Sriastradh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*a19ec087Sriastradh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*a19ec087Sriastradh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*a19ec087Sriastradh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*a19ec087Sriastradh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*a19ec087Sriastradh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*a19ec087Sriastradh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*a19ec087Sriastradh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*a19ec087Sriastradh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*a19ec087Sriastradh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*a19ec087Sriastradh  * POSSIBILITY OF SUCH DAMAGE.
27*a19ec087Sriastradh  */
28*a19ec087Sriastradh 
29*a19ec087Sriastradh #ifndef _ASM_VMWARE_H_
30*a19ec087Sriastradh #define _ASM_VMWARE_H_
31*a19ec087Sriastradh 
32*a19ec087Sriastradh #include <sys/cdefs.h>
33*a19ec087Sriastradh 
34*a19ec087Sriastradh #if defined __i386__ || defined __x86_64__
35*a19ec087Sriastradh 
36*a19ec087Sriastradh #define	VMWARE_HYPERVISOR_PORT		0x5658
37*a19ec087Sriastradh #define	VMWARE_HYPERVISOR_PORT_HB	0x5659
38*a19ec087Sriastradh 
39*a19ec087Sriastradh #define	VMWARE_HYPERVISOR_HB		__BIT(0)
40*a19ec087Sriastradh #define	VMWARE_HYPERVISOR_OUT		__BIT(1)
41*a19ec087Sriastradh 
42*a19ec087Sriastradh /* XXX support vmcall/vmmcall */
43*a19ec087Sriastradh #define	VMWARE_HYPERCALL						      \
44*a19ec087Sriastradh 	"movw $"__STRING(VMWARE_HYPERVISOR_PORT)",%%dx;"		      \
45*a19ec087Sriastradh 	"inl (%%dx),%%eax;"
46*a19ec087Sriastradh 
47*a19ec087Sriastradh #define	VMWARE_HYPERCALL_HB_OUT						      \
48*a19ec087Sriastradh 	"movw $"__STRING(VMWARE_HYPERVISOR_PORT_HB)",%%dx;"		      \
49*a19ec087Sriastradh 	"rep outsb;"
50*a19ec087Sriastradh 
51*a19ec087Sriastradh #define	VMWARE_HYPERCALL_HB_IN						      \
52*a19ec087Sriastradh 	"movw $"__STRING(VMWARE_HYPERVISOR_PORT_HB)",%%dx;"		      \
53*a19ec087Sriastradh 	"rep insb;"
54*a19ec087Sriastradh 
55*a19ec087Sriastradh #endif
56*a19ec087Sriastradh 
57*a19ec087Sriastradh #endif  /* _ASM_BARRIER_H_ */
58