Module Name:    src
Committed By:   maxv
Date:           Sat Sep  5 07:26:38 UTC 2020

Modified Files:
        src/sys/arch/amd64/amd64: trap.c
        src/sys/arch/i386/i386: trap.c
        src/sys/arch/x86/include: pte.h
        src/sys/dev/nvmm/x86: nvmm_x86_svm.c

Log Message:
x86: rename PGEX_X -> PGEX_I

To match the x86 specification and the other OSes.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.306 -r1.307 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/include/pte.h
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/nvmm/x86/nvmm_x86_svm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.127 src/sys/arch/amd64/amd64/trap.c:1.128
--- src/sys/arch/amd64/amd64/trap.c:1.127	Mon Mar  9 21:49:26 2020
+++ src/sys/arch/amd64/amd64/trap.c	Sat Sep  5 07:26:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.127 2020/03/09 21:49:26 pgoyette Exp $	*/
+/*	$NetBSD: trap.c,v 1.128 2020/09/05 07:26:37 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.127 2020/03/09 21:49:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.128 2020/09/05 07:26:37 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -450,7 +450,7 @@ trap(struct trapframe *frame)
 
 		cr2 = rcr2();
 
-		if (frame->tf_err & PGEX_X) {
+		if (frame->tf_err & PGEX_I) {
 			/* SMEP might have brought us here */
 			if (cr2 < VM_MAXUSER_ADDRESS) {
 				printf("prevented execution of %p (SMEP)\n",
@@ -503,7 +503,7 @@ pagefltcommon:
 			map = &vm->vm_map;
 		if (frame->tf_err & PGEX_W)
 			ftype = VM_PROT_WRITE;
-		else if (frame->tf_err & PGEX_X)
+		else if (frame->tf_err & PGEX_I)
 			ftype = VM_PROT_EXECUTE;
 		else
 			ftype = VM_PROT_READ;

Index: src/sys/arch/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.306 src/sys/arch/i386/i386/trap.c:1.307
--- src/sys/arch/i386/i386/trap.c:1.306	Tue Aug 11 04:30:16 2020
+++ src/sys/arch/i386/i386/trap.c	Sat Sep  5 07:26:37 2020
@@ -1,5 +1,5 @@
 
-/*	$NetBSD: trap.c,v 1.306 2020/08/11 04:30:16 christos Exp $	*/
+/*	$NetBSD: trap.c,v 1.307 2020/09/05 07:26:37 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.306 2020/08/11 04:30:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.307 2020/09/05 07:26:37 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -570,7 +570,7 @@ kernelfault:
 
 		cr2 = rcr2();
 
-		if (frame->tf_err & PGEX_X) {
+		if (frame->tf_err & PGEX_I) {
 			/* SMEP might have brought us here */
 			if (cr2 > VM_MIN_ADDRESS && cr2 <= VM_MAXUSER_ADDRESS) {
 				printf("prevented execution of %p (SMEP)\n",
@@ -620,7 +620,7 @@ faultcommon:
 			map = &vm->vm_map;
 		if (frame->tf_err & PGEX_W)
 			ftype = VM_PROT_WRITE;
-		else if (frame->tf_err & PGEX_X)
+		else if (frame->tf_err & PGEX_I)
 			ftype = VM_PROT_EXECUTE;
 		else
 			ftype = VM_PROT_READ;

Index: src/sys/arch/x86/include/pte.h
diff -u src/sys/arch/x86/include/pte.h:1.4 src/sys/arch/x86/include/pte.h:1.5
--- src/sys/arch/x86/include/pte.h:1.4	Sat Mar 14 04:55:14 2020
+++ src/sys/arch/x86/include/pte.h	Sat Sep  5 07:26:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pte.h,v 1.4 2020/03/14 04:55:14 maxv Exp $	*/
+/*	$NetBSD: pte.h,v 1.5 2020/09/05 07:26:37 maxv Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
 #define PGEX_W		0x0002	/* exception during a write cycle */
 #define PGEX_U		0x0004	/* exception while in user mode */
 #define PGEX_RSVD	0x0008	/* a reserved bit was set in the page tables */
-#define PGEX_X		0x0010	/* exception during instruction fetch */
+#define PGEX_I		0x0010	/* exception during instruction fetch */
 #define PGEX_PK		0x0020	/* access disallowed by protection key */
 #define PGEX_SGX	0x8000	/* violation of sgx-specific access rights */
 

Index: src/sys/dev/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.76 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.77
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.76	Sat Sep  5 07:22:26 2020
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Sat Sep  5 07:26:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.76 2020/09/05 07:22:26 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.77 2020/09/05 07:26:38 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.76 2020/09/05 07:22:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.77 2020/09/05 07:26:38 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1290,7 +1290,7 @@ svm_exit_npf(struct nvmm_machine *mach, 
 	exit->reason = NVMM_VCPU_EXIT_MEMORY;
 	if (cpudata->vmcb->ctrl.exitinfo1 & PGEX_W)
 		exit->u.mem.prot = PROT_WRITE;
-	else if (cpudata->vmcb->ctrl.exitinfo1 & PGEX_X)
+	else if (cpudata->vmcb->ctrl.exitinfo1 & PGEX_I)
 		exit->u.mem.prot = PROT_EXEC;
 	else
 		exit->u.mem.prot = PROT_READ;

Reply via email to