From cf8ee16d16e03276ff5990dca125841a96e57ccf Mon Sep 17 00:00:00 2001 From: deraadt Date: Mon, 16 Jan 2023 00:04:47 +0000 Subject: [PATCH] 3 new defines: he PTE protection key mask, the specific key value we use for execute-only, and the PKU value used by userland to use that key. --- sys/arch/amd64/include/pte.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/arch/amd64/include/pte.h b/sys/arch/amd64/include/pte.h index 40418d28f39..fc6f9cc4206 100644 --- a/sys/arch/amd64/include/pte.h +++ b/sys/arch/amd64/include/pte.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pte.h,v 1.15 2023/01/14 03:37:13 jsg Exp $ */ +/* $OpenBSD: pte.h,v 1.16 2023/01/16 00:04:47 deraadt Exp $ */ /* $NetBSD: pte.h,v 1.1 2003/04/26 18:39:47 fvdl Exp $ */ /* @@ -122,11 +122,15 @@ typedef u_int64_t pt_entry_t; /* PTE */ #define PG_AVAIL2 0x0000000000000400UL #define PG_AVAIL3 0x0000000000000800UL #define PG_PATLG 0x0000000000001000UL /* PAT on large pages */ +#define PG_PKMASK 0x7800000000000000UL /* Protection Key Mask */ +#define PG_XO 0x0800000000000000UL /* key1 used for execute-only */ #define PG_NX 0x8000000000000000UL /* non-executable */ #define PG_FRAME 0x000ffffffffff000UL #define PG_LGFRAME 0x000fffffffe00000UL /* large (2M) page frame mask */ +#define PGK_VALUE 0xfffffffc /* key0 is normal */ + /* EPT PTE bits */ #define EPT_R (1ULL << 0) #define EPT_W (1ULL << 1) -- 2.20.1