atop(virtual_avail), totalphysmem, VM_FREELIST_DEFAULT);
atop(endaddr), totalphysmem, VM_FREELIST_DEFAULT);
pmap_bootstrap(vstart)	vaddr_t vstart;{	extern char etext, etext1;	extern u_int totalphysmem, *ie_mem;	extern paddr_t hppa_vtop;	vaddr_t va, addr = hppa_round_page(vstart), t;	vsize_t size;#if 0 && (defined(HP7100LC_CPU) || defined(HP7300LC_CPU))	struct vp_entry *hptp;#endif	struct pmap *kpm;	DPRINTF(PDB_FOLLOW|PDB_INIT, ("pmap_bootstrap(0x%x)\n", vstart));	uvm_setpagesize();	hppa_prot[VM_PROT_NONE | VM_PROT_NONE  | VM_PROT_NONE]    =TLB_AR_NA;	hppa_prot[VM_PROT_READ | VM_PROT_NONE  | VM_PROT_NONE]    =TLB_AR_R;	hppa_prot[VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE]    =TLB_AR_RW;	hppa_prot[VM_PROT_READ | VM_PROT_WRITE | VM_PROT_NONE]    =TLB_AR_RW;	hppa_prot[VM_PROT_NONE | VM_PROT_NONE  | VM_PROT_EXECUTE] =TLB_AR_RX;	hppa_prot[VM_PROT_READ | VM_PROT_NONE  | VM_PROT_EXECUTE] =TLB_AR_RX;	hppa_prot[VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE] =TLB_AR_RWX;	hppa_prot[VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE] =TLB_AR_RWX;	/*	 * Initialize kernel pmap	 */	kpm = &kernel_pmap_store;	bzero(kpm, sizeof(*kpm));	simple_lock_init(&kpm->pm_obj.vmobjlock);	kpm->pm_obj.pgops = NULL;	TAILQ_INIT(&kpm->pm_obj.memq);	kpm->pm_obj.uo_npages = 0;	kpm->pm_obj.uo_refs = 1;	kpm->pm_space = HPPA_SID_KERNEL;	kpm->pm_pid = HPPA_PID_KERNEL;	kpm->pm_pdir_pg = NULL;	kpm->pm_pdir = addr;	bzero((void *)addr, PAGE_SIZE);	fdcache(HPPA_SID_KERNEL, addr, PAGE_SIZE);	addr += PAGE_SIZE;	/*	 * Allocate various tables and structures.	 */	mtctl(addr, CR_VTOP);	hppa_vtop = addr;	size = hppa_round_page((hppa_sid_max + 1) * 4);	bzero((void *)addr, size);	fdcache(HPPA_SID_KERNEL, addr, size);	DPRINTF(PDB_INIT, ("vtop: 0x%x @ 0x%x\n", size, addr));	addr += size;	pmap_sdir_set(HPPA_SID_KERNEL, kpm->pm_pdir);	ie_mem = (u_int *)addr;	addr += 0x8000;#if 0 && (defined(HP7100LC_CPU) || defined(HP7300LC_CPU))	if (pmap_hptsize && (cpu_type == hpcxl || cpu_type == hpcxl2)) {		int error;		if (pmap_hptsize > pdc_hwtlb.max_size)			pmap_hptsize = pdc_hwtlb.max_size;		else if (pmap_hptsize < pdc_hwtlb.min_size)			pmap_hptsize = pdc_hwtlb.min_size;		size = pmap_hptsize * sizeof(*hptp);		bzero((void *)addr, size);		/* Allocate the HPT */		for (hptp = (struct vp_entry *)addr, i = pmap_hptsize; i--;)			hptp[i].vp_tag = 0xffff;		DPRINTF(PDB_INIT, ("hpt_table: 0x%x @ %p\n", size, addr));		if ((error = (cpu_hpt_init)(addr, size)) < 0) {			printf("WARNING: HPT init error %d\n", error);		} else {			printf("HPT: %d entries @ 0x%x\n",			    pmap_hptsize / sizeof(struct vp_entry), addr);		}		/* TODO find a way to avoid using cr*, use cpu regs instead */		mtctl(addr, CR_VTOP);		mtctl(size - 1, CR_HPTMASK);		addr += size;	}#endif	/* HP7100LC_CPU | HP7300LC_CPU */	/* XXX PCXS needs two separate inserts in separate btlbs */	t = (vaddr_t)&etext1;	if (btlb_insert(HPPA_SID_KERNEL, 0, 0, &t,	    pmap_sid2pid(HPPA_SID_KERNEL) |	    pmap_prot(pmap_kernel(), UVM_PROT_RX)) < 0)		panic("pmap_bootstrap: cannot block map kernel text");	kpm->pm_stats.wired_count = kpm->pm_stats.resident_count =	    physmem = atop(t);	if (&etext < &etext1) {		physical_steal = (vaddr_t)&etext;		physical_end = (vaddr_t)&etext1;		DPRINTF(PDB_INIT, ("physpool: 0x%x @ 0x%x\n",		    physical_end - physical_steal, physical_steal));	}	/*	 * NOTE: we no longer trash the BTLB w/ unused entries,	 * lazy map only needed pieces (see bus_mem_add_mapping() for refs).	 */	addr = hppa_round_page(addr);	pmap_pv_page = addr;	pmap_pv_page_end =	addr += (totalphysmem / (16 * 1024)) * PAGE_SIZE;	size = hppa_round_page(sizeof(struct pv_head) * totalphysmem);	bzero ((caddr_t)addr, size);	virtual_avail = addr + size;	DPRINTF(PDB_INIT, ("pmseg.pvent: 0x%x @ 0x%x\n", size, addr));	/* XXX we might need to split this for isa */	uvm_page_physload(0, totalphysmem,		atop(virtual_avail), totalphysmem, VM_FREELIST_DEFAULT);	/* we have only one initial phys memory segment */	vm_physmem[0].pmseg.pvhead = (struct pv_head *)addr;	addr += size;	/* map .text to avoid reloading the btlb on heavy faults */	for (va = 0; va < (vaddr_t)&etext1; va += PAGE_SIZE)		pmap_kenter_pa(va, va, UVM_PROT_RX);	/* now we know how much to map */	for (; va < addr; va += PAGE_SIZE) {		extern struct user *proc0paddr;		pmap_kenter_pa(va, va,		    (va == (vaddr_t)proc0paddr + USPACE)?		    UVM_PROT_NONE : UVM_PROT_RW);	}	DPRINTF(PDB_INIT, ("bootstrap: mapped %p - 0x%x\n", &etext1, addr));}