version 1.121, 2016/05/14 08:49:16 |
version 1.124, 2016/05/15 07:17:53 |
Line 191 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 191 __KERNEL_RCSID(0, "$NetBSD$"); |
|
* This is done by the first instruction of fillkpt. In the non-PAE case, this |
* This is done by the first instruction of fillkpt. In the non-PAE case, this |
* instruction just clears the page table entry. |
* instruction just clears the page table entry. |
*/ |
*/ |
|
|
#define fillkpt \ |
#define fillkpt \ |
1: movl $0,(PDE_SIZE-4)(%ebx) ; /* upper 32 bits: 0 */ \ |
1: movl $0,(PDE_SIZE-4)(%ebx) ; /* upper 32 bits: 0 */ \ |
movl %eax,(%ebx) ; /* store phys addr */ \ |
movl %eax,(%ebx) ; /* store phys addr */ \ |
Line 555 try586: /* Use the `cpuid' instruction. |
|
Line 554 try586: /* Use the `cpuid' instruction. |
|
cpuid |
cpuid |
movl %eax,RELOC(cpuid_level) |
movl %eax,RELOC(cpuid_level) |
|
|
|
/* |
|
* Retrieve the NX/XD flag. We use the 32bit version of PG_NX. |
|
*/ |
|
movl $0x80000001,%eax |
|
cpuid |
|
andl $CPUID_NOX,%edx |
|
jz no_NOX |
|
movl $PG_NX32,RELOC(nox_flag) |
|
no_NOX: |
|
|
2: |
2: |
/* |
/* |
* Finished with old stack; load new %esp now instead of later so we |
* Finished with old stack; load new %esp now instead of later so we |
Line 571 try586: /* Use the `cpuid' instruction. |
|
Line 580 try586: /* Use the `cpuid' instruction. |
|
*/ |
*/ |
movl $_RELOC(tmpstk),%esp |
movl $_RELOC(tmpstk),%esp |
|
|
/* |
|
* Retrieve the NX/XD flag. We use the 32bit version of PG_NX. |
|
*/ |
|
movl $0x80000001,%eax |
|
cpuid |
|
andl $CPUID_NOX,%edx |
|
jz no_NOX |
|
movl $PG_NX32,RELOC(nox_flag) |
|
no_NOX: |
|
|
|
/* |
/* |
* There are two different layouts possible, depending on whether PAE is |
* There are two different layouts possible, depending on whether PAE is |
* enabled or not. |
* enabled or not. |
|
|
* |
* |
* PROC0 STK is obviously not linked as a page level. It just happens to be |
* PROC0 STK is obviously not linked as a page level. It just happens to be |
* caught between L2 and L1. |
* 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). */ |
/* Find end of kernel image; brings us on (1). */ |
|
|
orl $(PG_V|PG_KW),%eax |
orl $(PG_V|PG_KW),%eax |
fillkpt_nox |
fillkpt_nox |
|
|
/* |
/* Map [SYMS]+[PRELOADED MODULES] RWX. */ |
* We actually have to be careful here. The memory layout is as |
|
* follows: |
|
* +----------+---------------------+------------------+ |
|
* | DATA+BSS < [PRELOADED MODULES] | BOOTSTRAP TABLES > |
|
* +----------+---------------------+------------------+ |
|
* We just map everything from < to > with RWX rights. |
|
*/ |
|
movl $RELOC(__kernel_end),%eax |
movl $RELOC(__kernel_end),%eax |
movl %esi,%ecx /* start of BOOTSTRAP TABLES */ |
movl %esi,%ecx /* start of BOOTSTRAP TABLES */ |
addl RELOC(tablesize),%ecx /* end of BOOTSTRAP TABLES */ |
subl %eax,%ecx |
subl %eax,%ecx /* subtract end of kernel image */ |
|
shrl $PGSHIFT,%ecx |
shrl $PGSHIFT,%ecx |
orl $(PG_V|PG_KW),%eax |
orl $(PG_V|PG_KW),%eax |
fillkpt |
fillkpt |
|
|
/* Map ISA I/O mem (later atdevbase) */ |
/* Map the BOOTSTRAP TABLES RW. */ |
|
movl %esi,%eax /* start of BOOTSTRAP TABLES */ |
|
movl RELOC(tablesize),%ecx /* length of BOOTSTRAP TABLES */ |
|
shrl $PGSHIFT,%ecx |
|
orl $(PG_V|PG_KW),%eax |
|
fillkpt_nox |
|
|
|
/* We are on (4). Map ISA I/O mem (later atdevbase) RWX. */ |
movl $(IOM_BEGIN|PG_V|PG_KW/*|PG_N*/),%eax |
movl $(IOM_BEGIN|PG_V|PG_KW/*|PG_N*/),%eax |
movl $(IOM_SIZE>>PGSHIFT),%ecx |
movl $(IOM_SIZE>>PGSHIFT),%ecx |
fillkpt |
fillkpt |