Print this page
8956 Implement KPTI
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
*** 19,35 ****
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_MACH_MMU_H
#define _SYS_MACH_MMU_H
- #pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
--- 19,35 ----
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2018 Joyent, Inc.
*/
#ifndef _SYS_MACH_MMU_H
#define _SYS_MACH_MMU_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
*** 129,138 ****
--- 129,151 ----
*/
#define PT_NOSYNC (0x200) /* PTE was created with HAT_NOSYNC */
#define PT_NOCONSIST (0x400) /* PTE was created with HAT_LOAD_NOCONSIST */
#define PT_FOREIGN (0x600) /* MFN mapped on the hypervisor has no PFN */
+ #ifndef _BOOT
+
+ extern ulong_t getcr3(void);
+ extern void setcr3(ulong_t);
+
+ #define getcr3_pa() (getcr3() & MMU_PAGEMASK)
+ #define getpcid() ((getcr4() & CR4_PCIDE) ? \
+ (getcr3() & MMU_PAGEOFFSET) : PCID_NONE)
+
+ extern void mmu_invlpg(caddr_t);
+
+ #endif
+
#ifdef __xpv
#include <sys/xen_mmu.h>
#else
#include <sys/pc_mmu.h>
#endif
*** 149,162 ****
void set_pteval(paddr_t, uint_t, uint_t, x86pte_t);
paddr_t make_ptable(x86pte_t *, uint_t);
x86pte_t *find_pte(uint64_t, paddr_t *, uint_t, uint_t);
x86pte_t *map_pte(paddr_t, uint_t);
- #ifndef _BOOT
- ulong_t getcr3();
- #endif
-
extern uint_t *shift_amt;
extern uint_t ptes_per_table;
extern paddr_t top_page_table;
extern uint_t top_level;
extern uint_t pte_size;
--- 162,171 ----