adapt to new pmap.

This commit is contained in:
uch 2002-05-09 12:34:53 +00:00
parent 9e6860e202
commit 20ac353f38

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.40 2002/03/24 18:21:16 uch Exp $ */
/* $NetBSD: machdep.c,v 1.41 2002/05/09 12:34:53 uch Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -77,7 +77,6 @@
#include "opt_ddb.h"
#include "opt_kgdb.h"
#include "opt_syscall_debug.h"
#include "opt_memsize.h"
#include "opt_initbsc.h"
@ -88,7 +87,6 @@
#include <sys/mount.h>
#include <sys/reboot.h>
#include <sys/sysctl.h>
#include <sys/msgbuf.h>
#include <uvm/uvm_extern.h>
@ -112,12 +110,6 @@
char machine[] = MACHINE; /* evbsh3 */
char machine_arch[] = MACHINE_ARCH; /* sh3eb or sh3el */
paddr_t msgbuf_paddr;
extern paddr_t avail_start, avail_end;
extern char start[], etext[], edata[], end[];
#define IOM_RAM_END ((paddr_t)IOM_RAM_BEGIN + IOM_RAM_SIZE - 1)
void initSH3 __P((void *));
void LoadAndReset __P((char *));
void XLoadAndReset __P((char *));
@ -228,8 +220,8 @@ haltsys:
void
initSH3(void *pc) /* XXX return address */
{
extern char edata[], end[];
vaddr_t kernend;
vsize_t sz;
/* Clear bss */
memset(edata, 0, end - edata);
@ -262,39 +254,35 @@ initSH3(void *pc) /* XXX return address */
#else
#error "define SH3 or SH4"
#endif
/* Initialize proc0 and enable MMU. */
kernend = sh3_round_page(end);
sz = sh_proc0_init(kernend, IOM_RAM_BEGIN, IOM_RAM_END);
/* Number of pages of physmem addr space */
physmem = atop(IOM_RAM_END - IOM_RAM_BEGIN + 1);
/* avail_start is first available physical memory address */
avail_start = kernend + sz;
avail_end = IOM_RAM_END + 1;
/* Console */
consinit();
/* Load memory to UVM */
kernend = atop(round_page(SH3_P1SEG_TO_PHYS(end)));
physmem = atop(IOM_RAM_SIZE);
uvm_page_physload(
kernend, atop(IOM_RAM_BEGIN + IOM_RAM_SIZE),
kernend, atop(IOM_RAM_BEGIN + IOM_RAM_SIZE),
VM_FREELIST_DEFAULT);
/* Initialize proc0 u-area */
sh_proc0_init();
/* Initialize pmap and start to address translation */
pmap_bootstrap();
#ifdef DDB
ddb_init(0, NULL, NULL);
#endif
/* Call pmap initialization to make new kernel address space */
pmap_bootstrap(VM_MIN_KERNEL_ADDRESS);
/*
* Initialize error message buffer (at end of core).
*/
initmsgbuf((caddr_t)msgbuf_paddr, round_page(MSGBUFSIZE));
/*
* XXX We can't return here, because we change stack pointer.
* So jump to return address directly.
*/
__asm __volatile (
"jmp @%0;"
"mov %1, r15" :: "r"(pc), "r"(proc0.p_addr->u_pcb.pcb_sp));
"mov %1, r15"
:: "r"(pc),"r"(proc0.p_md.md_pcb->pcb_sf.sf_r7_bank));
}
/*
@ -479,16 +467,13 @@ shpcmcia_mem_add_mapping(bpa, size, type, bshp)
#undef MODE
for (; pa < endpa; pa += NBPG, va += NBPG) {
pmap_enter(pmap_kernel(), va, pa,
VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
pte = kvtopte(va);
*pte &= ~PG_N;
*pte |= m;
pmap_update_pg(va);
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pte = __pmap_kpte_lookup(va);
KDASSERT(pte);
*pte |= m; /* PTEA PCMCIA assistant bit */
sh_tlb_update(0, va, *pte);
}
pmap_update(pmap_kernel());
return 0;
}