Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Reduce the diff between amd64 and i386. We invert t...



details:   https://anonhg.NetBSD.org/src/rev/f02da13f721f
branches:  trunk
changeset: 345255:f02da13f721f
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun May 15 07:01:36 2016 +0000

description:
Reduce the diff between amd64 and i386. We invert two instructions on
amd64, but it makes no difference since PDE_SIZE = 8.

diffstat:

 sys/arch/amd64/amd64/locore.S |  26 +++++++++++++-------------
 sys/arch/i386/i386/locore.S   |  10 ++++++----
 2 files changed, 19 insertions(+), 17 deletions(-)

diffs (116 lines):

diff -r cf0f613fc972 -r f02da13f721f sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Sat May 14 21:32:50 2016 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Sun May 15 07:01:36 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.90 2016/05/12 09:05:16 maxv Exp $ */
+/*     $NetBSD: locore.S,v 1.91 2016/05/15 07:01:36 maxv Exp $ */
 
 /*
  * Copyright-o-rama!
@@ -220,23 +220,23 @@
  * Each entry is 8 (PDE_SIZE) bytes long: we must set the 4 upper bytes to 0.
  */
 #define fillkpt        \
-1:     movl    %eax,(%ebx)             ;       /* store phys addr */   \
-       movl    $0,(PDE_SIZE-4)(%ebx)   ;       /* upper 32 bits: 0 */  \
-       addl    $PDE_SIZE,%ebx          ;       /* next PTE/PDE */      \
-       addl    $PAGE_SIZE,%eax         ;       /* next phys page */    \
+1:     movl    $0,(PDE_SIZE-4)(%ebx)   ;       /* upper 32 bits: 0 */  \
+       movl    %eax,(%ebx)             ;       /* store phys addr */   \
+       addl    $PDE_SIZE,%ebx          ;       /* next PTE/PDE */      \
+       addl    $PAGE_SIZE,%eax         ;       /* next phys page */    \
        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    %eax,(%ebx)             ;       /* store phys addr */   \
-       movl    %ebp,(PDE_SIZE-4)(%ebx) ;       /* upper 32 bits: NX */ \
+       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                      ;       \
+       loop    1b                      ; \
        popl    %ebp                    ;
 
 /*
@@ -415,7 +415,7 @@
 
        /*
         * Load parameters from the stack (32 bits):
-        *     boothowto, [bootdev], bootinfo, esym, biosbasemem, biosextmem
+        *     boothowto, [bootdev], bootinfo, esym, biosextmem, biosbasemem
         * We are not interested in 'bootdev'.
         */
 
@@ -605,9 +605,9 @@
        movl    %edi,%esi
        addl    $PGOFSET,%esi
        andl    $~PGOFSET,%esi
-       movl    %esi,%edi
 
        /* Now, zero out the BOOTSTRAP TABLES (before filling them in). */
+       movl    %esi,%edi
        xorl    %eax,%eax
        cld
        movl    $TABLESIZE,%ecx
@@ -638,7 +638,7 @@
        orl     $(PG_V|PG_KR),%eax
        fillkpt
 
-       /* Map the kernel rodata RO. */
+       /* Map the kernel rodata R. */
        movl    $RELOC(__rodata_start),%eax
        movl    $RELOC(__data_start),%ecx
        subl    %eax,%ecx
diff -r cf0f613fc972 -r f02da13f721f sys/arch/i386/i386/locore.S
--- a/sys/arch/i386/i386/locore.S       Sat May 14 21:32:50 2016 +0000
+++ b/sys/arch/i386/i386/locore.S       Sun May 15 07:01:36 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.122 2016/05/14 09:51:56 maxv Exp $        */
+/*     $NetBSD: locore.S,v 1.123 2016/05/15 07:01:36 maxv Exp $        */
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.122 2016/05/14 09:51:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.123 2016/05/15 07:01:36 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -191,7 +191,6 @@
  * This is done by the first instruction of fillkpt. In the non-PAE case, this
  * instruction just clears the page table entry.
  */
-
 #define fillkpt        \
 1:     movl    $0,(PDE_SIZE-4)(%ebx)   ;       /* upper 32 bits: 0 */  \
        movl    %eax,(%ebx)             ;       /* store phys addr */   \
@@ -612,6 +611,9 @@
  *
  * PROC0 STK is obviously not linked as a page level. It just happens to be
  * caught between L2 and L1.
+ *
+ * Important note: the kernel segments are properly 4k-aligned
+ * (see kern.ldscript), so there's no need to enforce alignment.
  */
 
        /* Find end of kernel image; brings us on (1). */
@@ -732,7 +734,7 @@
        orl     $(PG_V|PG_KW),%eax
        fillkpt
 
-       /* Map ISA I/O mem (later atdevbase) */
+       /* We are on (4). Map ISA I/O mem (later atdevbase) RWX. */
        movl    $(IOM_BEGIN|PG_V|PG_KW/*|PG_N*/),%eax
        movl    $(IOM_SIZE>>PGSHIFT),%ecx
        fillkpt



Home | Main Index | Thread Index | Old Index