Define fillkpt_blank, which creates blank entries in a page table. Use

it to map the first MB. No functional change.
This commit is contained in:
maxv 2016-05-28 09:03:16 +00:00
parent 79fe8af4b4
commit fd2c2b78c0

View File

@ -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!
@ -244,6 +244,20 @@
popl %ebp ; \
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
@ -643,12 +657,12 @@ no_NOX:
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