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 fillkpt_nox on i386, same as amd64.



details:   https://anonhg.NetBSD.org/src/rev/8792bf2e490c
branches:  trunk
changeset: 815381:8792bf2e490c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat May 14 08:39:41 2016 +0000

description:
Define fillkpt_nox on i386, same as amd64.

But there is a difference in the way it is done here. If PAE is not enabled,
PDE_SIZE = 4, so there is no NOX bit set. If PAE is enabled, PDE_SIZE = 8,
so the NOX bit is set.

This works exactly as intended, since NOX does not exist in the non-PAE
case.

diffstat:

 sys/arch/i386/i386/locore.S |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 98ab5ee04da4 -r 8792bf2e490c sys/arch/i386/i386/locore.S
--- a/sys/arch/i386/i386/locore.S       Sat May 14 08:34:00 2016 +0000
+++ b/sys/arch/i386/i386/locore.S       Sat May 14 08:39:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.119 2016/05/14 08:34:00 maxv Exp $        */
+/*     $NetBSD: locore.S,v 1.120 2016/05/14 08:39:41 maxv Exp $        */
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.119 2016/05/14 08:34:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.120 2016/05/14 08:39:41 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -200,6 +200,19 @@
        loop    1b                      ;
 
 /*
+ * fillkpt_nox - Same as fillkpt, but sets the NX/XD bit.
+ */
+#define fillkpt_nox \
+       pushl   %ebp                    ; \
+       movl    RELOC(nox_flag),%ebp    ; \
+1:     movl    %ebp,(PDE_SIZE-4)(%ebx) ;       /* upper 32 bits: NX */ \
+       movl    %eax,(%ebx)             ;       /* store phys addr */   \
+       addl    $PDE_SIZE,%ebx          ;       /* next PTE/PDE */      \
+       addl    $PAGE_SIZE,%eax         ;       /* next phys page */    \
+       loop    1b                      ; \
+       popl    %ebp                    ;
+
+/*
  * killkpt - Destroy a kernel page table
  *     ebx = page table address
  *     ecx = number of pages to destroy



Home | Main Index | Thread Index | Old Index