Fixed bug causing machines with a memory size not a multiple of 16k

to crash. This is true on many MicroVAXen.
This commit is contained in:
ragge 1997-07-25 21:54:48 +00:00
parent f9e3ce0f92
commit b17d1e7207

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.36 1997/07/06 22:38:24 ragge Exp $ */
/* $NetBSD: pmap.c,v 1.37 1997/07/25 21:54:48 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -183,22 +183,21 @@ pmap_bootstrap()
* physical memory and that isn't managed by the vm system.
*/
#ifdef DDB
MAPPHYS(junk, ((ROUND_PAGE(&etext) - KERNBASE) >> PGSHIFT),
MAPPHYS(junk, btoc(ROUND_PAGE(&etext) - KERNBASE),
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
#else
MAPPHYS(junk, ((ROUND_PAGE(&etext) - KERNBASE) >> PGSHIFT),
VM_PROT_EXECUTE);
MAPPHYS(junk, btoc(ROUND_PAGE(&etext) - KERNBASE), VM_PROT_EXECUTE);
#endif
MAPPHYS(junk, (((u_int)Sysmap - ROUND_PAGE(&etext)) >> PGSHIFT),
MAPPHYS(junk, btoc((u_int)Sysmap - ROUND_PAGE(&etext)),
VM_PROT_READ|VM_PROT_WRITE);
/* Map System Page Table and zero it, Sysmap already set. */
mtpr(avail_start, PR_SBR);
MAPPHYS(junk, (ROUND_PAGE(sysptsize * 4) >> PGSHIFT),
MAPPHYS(junk, btoc(ROUND_PAGE(sysptsize * 4)),
VM_PROT_READ|VM_PROT_WRITE);
/* Map Interrupt stack and set red zone */
MAPPHYS(istack, (ISTACK_SIZE >> PGSHIFT), VM_PROT_READ|VM_PROT_WRITE);
MAPPHYS(istack, btoc(ISTACK_SIZE), VM_PROT_READ|VM_PROT_WRITE);
mtpr(istack + ISTACK_SIZE, PR_ISP);
kvtopte(istack)->pg_v = 0;
@ -206,12 +205,12 @@ pmap_bootstrap()
MAPPHYS(scratch, 4, VM_PROT_READ|VM_PROT_WRITE);
/* Kernel message buffer */
MAPPHYS(msgbufp, ((u_int)ROUND_PAGE(sizeof(struct msgbuf)) >> PGSHIFT),
MAPPHYS(msgbufp, btoc(ROUND_PAGE(sizeof(struct msgbuf))),
VM_PROT_READ|VM_PROT_WRITE);
/* Physical-to-virtual translation table */
MAPPHYS(pv_table, ((avail_end / PAGE_SIZE ) * sizeof(struct pv_entry))
>> PGSHIFT, VM_PROT_READ|VM_PROT_WRITE);
MAPPHYS(pv_table, btoc((avail_end / PAGE_SIZE ) *
sizeof(struct pv_entry)), VM_PROT_READ|VM_PROT_WRITE);
/* zero all mapped physical memory from Sysmap to here */
blkclr((void *)istack, (avail_start | 0x80000000) - istack);