Module Name: src Committed By: maxv Date: Sun May 15 07:01:36 UTC 2016
Modified Files: src/sys/arch/amd64/amd64: locore.S src/sys/arch/i386/i386: locore.S Log Message: Reduce the diff between amd64 and i386. We invert two instructions on amd64, but it makes no difference since PDE_SIZE = 8. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.122 -r1.123 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/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.90 src/sys/arch/amd64/amd64/locore.S:1.91 --- src/sys/arch/amd64/amd64/locore.S:1.90 Thu May 12 09:05:16 2016 +++ src/sys/arch/amd64/amd64/locore.S Sun May 15 07:01:36 2016 @@ -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 @@ ENTRY(start) /* * 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 @@ no_NOX: 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 @@ no_NOX: 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 Index: src/sys/arch/i386/i386/locore.S diff -u src/sys/arch/i386/i386/locore.S:1.122 src/sys/arch/i386/i386/locore.S:1.123 --- src/sys/arch/i386/i386/locore.S:1.122 Sat May 14 09:51:56 2016 +++ src/sys/arch/i386/i386/locore.S Sun May 15 07:01:36 2016 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1 * 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 @@ no_NOX: * * 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 @@ no_NOX: 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