xref: /illumos-gate/usr/src/uts/i86pc/sys/pc_mmu.h (revision 74ecdb5171c9f3673b9393b1a3dc6f3a65e93895)
1ae115bc7Smrj /*
2ae115bc7Smrj  * CDDL HEADER START
3ae115bc7Smrj  *
4ae115bc7Smrj  * The contents of this file are subject to the terms of the
5ae115bc7Smrj  * Common Development and Distribution License (the "License").
6ae115bc7Smrj  * You may not use this file except in compliance with the License.
7ae115bc7Smrj  *
8ae115bc7Smrj  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9ae115bc7Smrj  * or http://www.opensolaris.org/os/licensing.
10ae115bc7Smrj  * See the License for the specific language governing permissions
11ae115bc7Smrj  * and limitations under the License.
12ae115bc7Smrj  *
13ae115bc7Smrj  * When distributing Covered Code, include this CDDL HEADER in each
14ae115bc7Smrj  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15ae115bc7Smrj  * If applicable, add the following below this CDDL HEADER, with the
16ae115bc7Smrj  * fields enclosed by brackets "[]" replaced with your own identifying
17ae115bc7Smrj  * information: Portions Copyright [yyyy] [name of copyright owner]
18ae115bc7Smrj  *
19ae115bc7Smrj  * CDDL HEADER END
20ae115bc7Smrj  */
21ae115bc7Smrj /*
22ae115bc7Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23ae115bc7Smrj  * Use is subject to license terms.
24*74ecdb51SJohn Levon  *
25*74ecdb51SJohn Levon  * Copyright 2018 Joyent, Inc.
26ae115bc7Smrj  */
27ae115bc7Smrj 
28ae115bc7Smrj #ifndef _SYS_PC_MMU_H
29ae115bc7Smrj #define	_SYS_PC_MMU_H
30ae115bc7Smrj 
31ae115bc7Smrj #ifdef __cplusplus
32ae115bc7Smrj extern "C" {
33ae115bc7Smrj #endif
34ae115bc7Smrj 
35ae115bc7Smrj /*
36ae115bc7Smrj  * Platform-dependent MMU routines and types for real x86 hardware.
37ae115bc7Smrj  *
38ae115bc7Smrj  * WARNING: this header file is used by both dboot and i86pc, so don't go using
39ae115bc7Smrj  * normal kernel headers.
40ae115bc7Smrj  */
41ae115bc7Smrj 
42ae115bc7Smrj #define	IN_HYPERVISOR_VA(va) (__lintzero)
43ae115bc7Smrj 
44ae115bc7Smrj void reload_cr3(void);
45ae115bc7Smrj 
46ae115bc7Smrj #define	pa_to_ma(pa) (pa)
47ae115bc7Smrj #define	ma_to_pa(ma) (ma)
48ae115bc7Smrj #define	pfn_to_mfn(pfn) (pfn)
49ae115bc7Smrj #define	mfn_to_pfn(mfn)	(mfn)
50ae115bc7Smrj 
51ae115bc7Smrj #ifndef _BOOT
52ae115bc7Smrj 
53*74ecdb51SJohn Levon extern uint64_t kpti_safe_cr3;
54*74ecdb51SJohn Levon 
55*74ecdb51SJohn Levon #define	INVPCID_ADDR		(0)
56*74ecdb51SJohn Levon #define	INVPCID_ID		(1)
57*74ecdb51SJohn Levon #define	INVPCID_ALL_GLOBAL	(2)
58*74ecdb51SJohn Levon #define	INVPCID_ALL_NONGLOBAL	(3)
59*74ecdb51SJohn Levon 
60*74ecdb51SJohn Levon extern void invpcid_insn(uint64_t, uint64_t, uintptr_t);
61*74ecdb51SJohn Levon extern void tr_mmu_flush_user_range(uint64_t, size_t, size_t, uint64_t);
62ae115bc7Smrj 
63ae115bc7Smrj #if defined(__GNUC__)
64ae115bc7Smrj #include <asm/mmu.h>
65ae115bc7Smrj #endif
66ae115bc7Smrj 
67ae115bc7Smrj #endif /* !_BOOT */
68ae115bc7Smrj 
69ae115bc7Smrj #ifdef __cplusplus
70ae115bc7Smrj }
71ae115bc7Smrj #endif
72ae115bc7Smrj 
73ae115bc7Smrj #endif	/* _SYS_PC_MMU_H */
74