Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/i386 Define and use fillkpt_blank on i386, lik...



details:   https://anonhg.NetBSD.org/src/rev/3e192fe36be6
branches:  trunk
changeset: 345661:3e192fe36be6
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jun 04 10:02:12 2016 +0000

description:
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.

diffstat:

 sys/arch/i386/i386/locore.S |  29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)

diffs (59 lines):

diff -r 9cc268ad9cb8 -r 3e192fe36be6 sys/arch/i386/i386/locore.S
--- a/sys/arch/i386/i386/locore.S       Sat Jun 04 09:52:41 2016 +0000
+++ b/sys/arch/i386/i386/locore.S       Sat Jun 04 10:02:12 2016 +0000
@@ -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 @@
 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 @@
        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



Home | Main Index | Thread Index | Old Index