Subject: Re: port-i386/5102: i386 kernels larger than about 3.1MB won't load correctly
To: Chuck Cranor <chuck@dworkin.wustl.edu>
From: Matthias Drochner <drochner@zelux6.zel.kfa-juelich.de>
List: netbsd-bugs
Date: 03/03/1998 19:56:42
Looking into it, I found little reason to install the bioscall page in locore.
How about this change? (tested with PMAP_NEW only)
best regards
Matthias
Index: locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/locore.s,v
retrieving revision 1.188
diff -c -2 -r1.188 locore.s
*** locore.s 1998/02/22 08:19:05 1.188
--- locore.s 1998/03/03 18:54:38
***************
*** 51,55 ****
#include "assym.h"
#include "apm.h"
- #include "bioscall.h"
#include <sys/errno.h>
--- 51,54 ----
***************
*** 475,484 ****
#define PROC0STACK ((1) * NBPG)
#define SYSMAP ((1+UPAGES) * NBPG)
! #if NBIOSCALL > 0
! #define BIOSCALL_PDE_SPACE 1
! #else
! #define BIOSCALL_PDE_SPACE 0
! #endif
! #define TABLESIZE ((1+UPAGES+BIOSCALL_PDE_SPACE) * NBPG) /* + nkpde * NBPG */
/* Find end of kernel image. */
--- 474,478 ----
#define PROC0STACK ((1) * NBPG)
#define SYSMAP ((1+UPAGES) * NBPG)
! #define TABLESIZE ((1+UPAGES) * NBPG) /* + nkpde * NBPG */
/* Find end of kernel image. */
***************
*** 594,600 ****
* Construct a page table directory.
*/
! /* Install a PDE for temporary double map of kernel text. */
leal (SYSMAP+PG_V|PG_KW)(%esi),%eax # pte for KPT in proc 0,
! movl %eax,(PROC0PDIR+0*4)(%esi) # which is where temp maps!
/* Map kernel PDEs. */
movl RELOC(_nkpde),%ecx # for this many pde s,
--- 588,597 ----
* Construct a page table directory.
*/
! /* Install a PDE for temporary double map of kernel. */
! movl RELOC(_nkpde),%ecx # for this many pde s,
! leal (PROC0PDIR+0*4)(%esi),%ebx # which is where temp maps!
leal (SYSMAP+PG_V|PG_KW)(%esi),%eax # pte for KPT in proc 0,
! fillkpt
!
/* Map kernel PDEs. */
movl RELOC(_nkpde),%ecx # for this many pde s,
***************
*** 604,619 ****
leal (PROC0PDIR+KPTDI*4)(%esi),%ebx # offset of pde for kernel
#endif
fillkpt
- #if NBIOSCALL > 0
- /* set up special identity mapping page table to get to
- page 1 for BIOS trampoline. store it in PTD 1 to start, though.... */
-
- /* use remaining page table page at %eax */
- movl $1,%ecx # only add mapping for one PTDE
- leal (PROC0PDIR+1*4)(%esi),%ebx # PTD entry address
- fillkpt
- #endif
-
/* Install a PDE recursively mapping page directory as a page table! */
leal (PROC0PDIR+PG_V|PG_KW)(%esi),%eax # pte for ptd
--- 601,607 ----
leal (PROC0PDIR+KPTDI*4)(%esi),%ebx # offset of pde for kernel
#endif
+ leal (SYSMAP+PG_V|PG_KW)(%esi),%eax # pte for KPT in proc 0,
fillkpt
/* Install a PDE recursively mapping page directory as a page table! */
leal (PROC0PDIR+PG_V|PG_KW)(%esi),%eax # pte for ptd
***************
*** 639,651 ****
begin:
! /* Now running relocated at KERNBASE. Remove double mapping. */
! #if NBIOSCALL > 0
! /* move page table pointer for bios trampoline to final resting place */
! movl (PROC0PDIR+1*4)(%esi),%edx
! movl %edx,(PROC0PDIR+0*4)(%esi)
! movl $0,(PROC0PDIR+1*4)(%esi)
! #else
! movl $0,(PROC0PDIR+0*4)(%esi)
! #endif
/* Relocate atdevbase. */
--- 627,631 ----
begin:
! /* Now running relocated at KERNBASE. Double mapping is removed in
init386(). */
/* Relocate atdevbase. */
Index: machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.293
diff -c -2 -r1.293 machdep.c
*** machdep.c 1998/02/19 04:18:32 1.293
--- machdep.c 1998/03/03 18:54:42
***************
*** 1703,1706 ****
--- 1708,1719 ----
extern void consinit __P((void));
+ /* remove double mapping */
+ for (x = 0; x < nkpde; x++)
+ #if defined(PMAP_NEW)
+ *(PDP_BASE + x) = 0;
+ #else
+ PTD[x] = 0;
+ #endif
+
proc0.p_addr = proc0paddr;
#if defined(PMAP_NEW)
***************
*** 1765,1769 ****
#if NBIOSCALL > 0
! avail_start = 2*NBPG; /* save us a page! */
#else
avail_start = NBPG; /* BIOS leaves data in low memory */
--- 1778,1783 ----
#if NBIOSCALL > 0
! avail_start = 3*NBPG; /* save us a page for trampoline code and
! one additional PT page! */
#else
avail_start = NBPG; /* BIOS leaves data in low memory */
***************
*** 1786,1789 ****
--- 1800,1807 ----
#endif
+ #if NBIOSCALL > 0
+ /* install page 2 (reserved above) as PT page for first 4M */
+ pmap_enter(pmap_kernel(), (u_long)vtopte(0), 2*NBPG, VM_PROT_ALL, TRUE);
+ #endif
pmap_enter(pmap_kernel(), idt_vaddr, idt_paddr, VM_PROT_ALL, TRUE);