Module Name: src
Committed By: maxv
Date: Sat Jun 4 10:02:12 UTC 2016
Modified Files:
src/sys/arch/i386/i386: locore.S
Log Message:
Define and use fillkpt_blank on i386, like amd64. The PAE case is
included in fillkpt_blank, since PDE_SIZE is either 4 or 8 bytes.
To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/i386/i386/locore.S
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/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.128 src/sys/arch/i386/i386/locore.S:1.129
--- src/sys/arch/i386/i386/locore.S:1.128 Sat Jun 4 09:52:41 2016
+++ src/sys/arch/i386/i386/locore.S Sat Jun 4 10:02:12 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.128 2016/06/04 09:52:41 maxv Exp $ */
+/* $NetBSD: locore.S,v 1.129 2016/06/04 10:02:12 maxv Exp $ */
/*
* Copyright-o-rama!
@@ -128,7 +128,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.128 2016/06/04 09:52:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.129 2016/06/04 10:02:12 maxv Exp $");
#include "opt_compat_oldboot.h"
#include "opt_copy_symtab.h"
@@ -219,6 +219,20 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
2: ;
/*
+ * fillkpt_blank - Fill in a kernel page table with blank entries
+ * ebx = page table address
+ * ecx = number of pages to map
+ */
+#define fillkpt_blank \
+ cmpl $0,%ecx ; /* zero-sized? */ \
+ je 2f ; \
+1: movl $0,(PDE_SIZE-4)(%ebx) ; /* upper 32 bits: 0 */ \
+ movl $0,(%ebx) ; /* lower 32 bits: 0 */ \
+ addl $PDE_SIZE,%ebx ; /* next PTE/PDE */ \
+ loop 1b ; \
+2: ;
+
+/*
* killkpt - Destroy a kernel page table
* ebx = page table address
* ecx = number of pages to destroy
@@ -696,15 +710,12 @@ no_NOX:
leal (PROC0_PTP1_OFF)(%esi),%ebx
/* Skip the first MB. */
- movl $(KERNTEXTOFF - KERNBASE),%eax
- movl %eax,%ecx
- shrl $(PGSHIFT-2),%ecx /* ((n >> PGSHIFT) << 2) for # PDEs */
-#ifdef PAE
- shll $1,%ecx /* PDEs are twice larger with PAE */
-#endif
- addl %ecx,%ebx
+ movl $(KERNTEXTOFF - KERNBASE),%ecx
+ shrl $PGSHIFT,%ecx
+ fillkpt_blank
/* Map the kernel text RX. */
+ movl $(KERNTEXTOFF - KERNBASE),%eax /* start of TEXT */
movl $RELOC(__rodata_start),%ecx
subl %eax,%ecx
shrl $PGSHIFT,%ecx