vm_offset_t addr, p;
vaddr_t addr;
pmap_bootstrap(vstart, vend)	vm_offset_t *vstart;	vm_offset_t *vend;{	extern u_int totalphysmem;	vm_offset_t addr, p;	vm_size_t size;	struct pv_page *pvp;	int i;#ifdef PMAPDEBUG	if (pmapdebug & PDB_FOLLOW)		printf("pmap_bootstrap(%p, %p)\n", vstart, vend);#endif	vm_set_page_size();	pages_per_vm_page = PAGE_SIZE / NBPG;	/* XXX for now */	if (pages_per_vm_page != 1)		panic("HPPA page != VM page");	kern_prot[VM_PROT_NONE | VM_PROT_NONE  | VM_PROT_NONE]    =TLB_AR_NA;	kern_prot[VM_PROT_READ | VM_PROT_NONE  | VM_PROT_NONE]    =TLB_AR_KR;	kern_prot[VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE]    =TLB_AR_KRW;	kern_prot[VM_PROT_READ | VM_PROT_WRITE | VM_PROT_NONE]    =TLB_AR_KRW;	kern_prot[VM_PROT_NONE | VM_PROT_NONE  | VM_PROT_EXECUTE] =TLB_AR_KRX;	kern_prot[VM_PROT_READ | VM_PROT_NONE  | VM_PROT_EXECUTE] =TLB_AR_KRX;	kern_prot[VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE] =TLB_AR_KRWX;	kern_prot[VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE] =TLB_AR_KRWX;	user_prot[VM_PROT_NONE | VM_PROT_NONE  | VM_PROT_NONE]    =TLB_AR_NA;	user_prot[VM_PROT_READ | VM_PROT_NONE  | VM_PROT_NONE]    =TLB_AR_UR;	user_prot[VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE]    =TLB_AR_URW;	user_prot[VM_PROT_READ | VM_PROT_WRITE | VM_PROT_NONE]    =TLB_AR_URW;	user_prot[VM_PROT_NONE | VM_PROT_NONE  | VM_PROT_EXECUTE] =TLB_AR_URX;	user_prot[VM_PROT_READ | VM_PROT_NONE  | VM_PROT_EXECUTE] =TLB_AR_URX;	user_prot[VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE] =TLB_AR_URWX;	user_prot[VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE] =TLB_AR_URWX;	/*	 * Initialize kernel pmap	 */	kernel_pmap = &kernel_pmap_store;#if	NCPUS > 1	lock_init(&pmap_lock, FALSE, ETAP_VM_PMAP_SYS, ETAP_VM_PMAP_SYS_I);#endif	/* NCPUS > 1 */       	simple_lock_init(&kernel_pmap->pmap_lock);	simple_lock_init(&pmap_freelock);	simple_lock_init(&sid_pid_lock);	kernel_pmap->pmap_refcnt = 1;	kernel_pmap->pmap_space = HPPA_SID_KERNEL;	kernel_pmap->pmap_pid = HPPA_PID_KERNEL;	/*	 * Allocate various tables and structures.	 */	addr = *vstart;	virtual_end = *vend;	pvp = (struct pv_page *)cache_align(addr);	size = sizeof(struct hpt_entry) * hpt_hashsize;	addr = (addr + size-1) & ~(size-1);	TAILQ_INIT(&pv_page_freelist);#ifdef PMAPDEBUG	if (pmapdebug & PDB_INIT)		printf("pmap_bootstrap: allocating %d pv_pages\n",		       (struct pv_page *)addr - pvp);#endif	for (; pvp + 1 <= (struct pv_page *)addr; pvp++)		pmap_insert_pvp(pvp, 1);	/* Allocate the HPT */	hpt_table = (struct hpt_entry *) addr;	for (i = 0; i < hpt_hashsize; i++) {		hpt_table[i].hpt_valid   = 0;		hpt_table[i].hpt_vpn     = 0;		hpt_table[i].hpt_space   = -1;		hpt_table[i].hpt_tlbpage = 0;		hpt_table[i].hpt_tlbprot = 0;		hpt_table[i].hpt_entry   = NULL;	}	addr = (vm_offset_t)&hpt_table[hpt_hashsize];#ifdef PMAPDEBUG	if (pmapdebug & PDB_INIT)		printf("hpt_table: 0x%x @ %p\n", size, hpt_table);	#endif	/* load cr25 with the address of the HPT table	   NB: It sez CR_VTOP, but we (and the TLB handlers) know better ... */	mtctl(hpt_table, CR_VTOP);	addr = hppa_round_page(addr);	size = hppa_round_page(sizeof(struct pv_entry) *			       (totalphysmem - atop(virtual_avail)));	bzero ((caddr_t)addr, size);#ifdef PMAPDEBUG	if (pmapdebug & PDB_INIT)		printf("pv_array: 0x%x @ 0x%x\n", size, addr);#endif	/* map the kernel space, which will give us virtual_avail */	*vstart = hppa_round_page(addr + size + totalphysmem * 64);	if (btlb_insert(kernel_pmap->pmap_space, 0, 0, vstart,			kernel_pmap->pmap_pid |			pmap_prot(kernel_pmap, VM_PROT_ALL)) < 0)		panic("pmap_bootstrap: cannot block map kernel");	virtual_avail = *vstart;	/* hack to block map the whole IO space */	p = HPPA_IOLEN / 4;	for (i = 4; i--; ) {		if (btlb_insert(kernel_pmap->pmap_space,				HPPA_IOBEGIN + i * (HPPA_IOLEN / 4),				HPPA_IOBEGIN + i * (HPPA_IOLEN / 4),				&p, kernel_pmap->pmap_pid |				pmap_prot(kernel_pmap, VM_PROT_ALL)) < 0)			panic("pmap_bootstrap: cannot block map I/O space");	}	i = atop(virtual_avail - virtual_steal);	vm_page_physload(atop(virtual_avail), totalphysmem + i,			 atop(virtual_avail), totalphysmem + i);	/* we have only one initial phys memory segment */	vm_physmem[0].pmseg.pvent = (struct pv_entry *)addr;	virtual_steal = addr += size;	/* here will be a hole due to the kernel memory alignment	   and we use it for pmap_steal_memory */}