Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/amd64 Define fillkpt_blank, which creates bla...



details:   https://anonhg.NetBSD.org/src/rev/bed1993c26c0
branches:  trunk
changeset: 815582:bed1993c26c0
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat May 28 09:03:16 2016 +0000

description:
Define fillkpt_blank, which creates blank entries in a page table. Use
it to map the first MB. No functional change.

diffstat:

 sys/arch/amd64/amd64/locore.S |  24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r 533b0883bab1 -r bed1993c26c0 sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Sat May 28 08:43:16 2016 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Sat May 28 09:03:16 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.95 2016/05/28 08:43:16 maxv Exp $ */
+/*     $NetBSD: locore.S,v 1.96 2016/05/28 09:03:16 maxv Exp $ */
 
 /*
  * Copyright-o-rama!
@@ -245,6 +245,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 (long mode)
  *     rbx = page table address
  *     rcx = number of pages to destroy
@@ -643,12 +657,12 @@
        leal    (PROC0_PTP1_OFF)(%esi),%ebx
 
        /* Skip the first MB. */
-       movl    $(KERNTEXTOFF_LO - KERNBASE_LO),%eax
-       movl    %eax,%ecx
-       shrl    $(PGSHIFT-3),%ecx       /* ((n >> PGSHIFT) << 3) for # PDEs */
-       addl    %ecx,%ebx
+       movl    $(KERNTEXTOFF_LO - KERNBASE_LO),%ecx
+       shrl    $PGSHIFT,%ecx
+       fillkpt_blank
 
        /* Map the kernel text RX. */
+       movl    $(KERNTEXTOFF_LO - KERNBASE_LO),%eax    /* start of TEXT */
        movl    $RELOC(__rodata_start),%ecx
        subl    %eax,%ecx
        shrl    $PGSHIFT,%ecx



Home | Main Index | Thread Index | Old Index