xref: /illumos-gate/usr/src/uts/i86pc/sys/pc_mmu.h (revision 74ecdb51)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
528cdc3d7Sszhou  * Common Development and Distribution License (the "License").
628cdc3d7Sszhou  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22ae115bc7Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
24*74ecdb51SJohn Levon  *
25*74ecdb51SJohn Levon  * Copyright 2018 Joyent, Inc.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
28ae115bc7Smrj #ifndef _SYS_PC_MMU_H
29ae115bc7Smrj #define	_SYS_PC_MMU_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
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)
437c478bd9Sstevel@tonic-gate 
44ae115bc7Smrj void reload_cr3(void);
457c478bd9Sstevel@tonic-gate 
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)
501fac5a60Ssetje 
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
667c478bd9Sstevel@tonic-gate 
67ae115bc7Smrj #endif /* !_BOOT */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #ifdef __cplusplus
707c478bd9Sstevel@tonic-gate }
717c478bd9Sstevel@tonic-gate #endif
727c478bd9Sstevel@tonic-gate 
73ae115bc7Smrj #endif	/* _SYS_PC_MMU_H */
74