vm_page_physload(atop(fromads), atop(toads),
uvm_page_physload(atop(fromads), atop(toads),
TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;int		pv_nfree;#if defined(M68040) || defined(M68060)static int	pmap_ishift;	/* segment table index shift */int		protostfree;	/* prototype (default) free ST map */#endifextern paddr_t	msgbufpa;	/* physical address of the msgbuf */u_long		noncontig_enable;extern vm_offset_t z2mem_start;boolean_t	pmap_testbit __P((register vm_offset_t, int));void		pmap_enter_ptpage __P((register pmap_t, register vm_offset_t));void		pmap_collect1 __P((pmap_t, vm_offset_t, vm_offset_t));extern vm_offset_t reserve_dumppages __P((vm_offset_t));static void amiga_protection_init __P((void));void pmap_check_wiring __P((char *, vm_offset_t));static void pmap_changebit __P((register vm_offset_t, int, boolean_t));struct pv_entry * pmap_alloc_pv __P((void));void pmap_free_pv __P((struct pv_entry *));#ifdef DEBUG            void pmap_pvdump __P((vm_offset_t));  #endif/* * All those kernel PT submaps that BSD is so fond of */caddr_t	CADDR1, CADDR2, vmmap;u_int	*CMAP1, *CMAP2, *vmpte, *msgbufmap;#define	PAGE_IS_MANAGED(pa) (pmap_initialized &&	\			vm_physseg_find(atop((pa)), NULL) != -1)#define pa_to_pvh(pa) \({ \	int bank_, pg_; \	bank_ = vm_physseg_find(atop((pa)), &pg_); \	&vm_physmem[bank_].pmseg.pvent[pg_]; \})#define pa_to_attribute(pa) \({ \	int bank_, pg_; \	bank_ = vm_physseg_find(atop((pa)), &pg_); \	&vm_physmem[bank_].pmseg.attrs[pg_]; \})/* *	Bootstrap the system enough to run with virtual memory. *	Map the kernel's code and data, and allocate the system page table. * *	On the HP this is called after mapping has already been enabled *	and just syncs the pmap module with what has already been done. *	[We can't call it easily with mapping off since the kernel is not *	mapped with PA == VA, hence we would have to relocate every address *	from the linked base (virtual) address 0 to the actual (physical) *	address of 0xFFxxxxxx.] */voidpmap_bootstrap(firstaddr, loadaddr)	vm_offset_t firstaddr;	vm_offset_t loadaddr;{	vm_offset_t va;	u_int *pte;	int i;	struct boot_memseg *sp, *esp;	vm_offset_t fromads, toads;	fromads = firstaddr;	toads = maxmem << PGSHIFT;	/* XXX: allow for msgbuf */	toads -= m68k_round_page(MSGBUFSIZE);	msgbufpa = toads;	/*	 * first segment of memory is always the one loadbsd found	 * for loading the kernel into.	 */#if defined(UVM)	uvm_page_physload(atop(fromads), atop(toads),		atop(fromads), atop(toads), VM_FREELIST_DEFAULT);#else	vm_page_physload(atop(fromads), atop(toads),		atop(fromads), atop(toads));#endif	sp = memlist->m_seg;	esp = sp + memlist->m_nseg;	i = 1;	for (; noncontig_enable && sp < esp; sp++) {		if ((sp->ms_attrib & MEMF_FAST) == 0)			continue;		/* skip if not FastMem */		if (firstaddr >= sp->ms_start &&		    firstaddr < sp->ms_start + sp->ms_size)			continue;		/* skip kernel segment */		if (sp->ms_size == 0)			continue;		/* skip zero size segments */		fromads = sp->ms_start;		toads = sp->ms_start + sp->ms_size;#ifdef DEBUG_A4000		/*		 * My A4000 doesn't seem to like Zorro II memory - this		 * hack is to skip the motherboard memory and use the		 * Zorro II memory.  Only for trying to debug the problem.		 * Michael L. Hitch		 */		if (toads == 0x08000000)			continue;	/* skip A4000 motherboard mem */#endif		/*		 * Deal with Zorro II memory stolen for DMA bounce buffers.		 * This needs to be handled better.		 *		 * XXX is: disabled. This is handled now in amiga_init.c		 * by removing the stolen memory from the memlist.		 *		 * XXX is: enabled again, but check real size and position.		 * We check z2mem_start is in this segment, and set its end		 * to the z2mem_start.		 * 		 */		if ((fromads <= z2mem_start) && (toads > z2mem_start))			toads = z2mem_start;#if defined(UVM)		vm_page_physload(atop(fromads), atop(toads),			atop(fromads), atop(toads), (fromads & 0xff000000) ?			VM_FREELIST_DEFAULT : VM_FREELIST_ZORROII);#else		vm_page_physload(atop(fromads), atop(toads),			atop(fromads), atop(toads));#endif		physmem += (toads - fromads) / NBPG;		++i;		if (noncontig_enable == 1)			break;		/* Only two segments enabled */	}	mem_size = physmem << PGSHIFT;	virtual_avail = VM_MIN_KERNEL_ADDRESS + (firstaddr - loadaddr);	virtual_end = VM_MAX_KERNEL_ADDRESS;	/*	 * Initialize protection array.	 */	amiga_protection_init();	/*	 * Kernel page/segment table allocated in locore,	 * just initialize pointers.	 */	pmap_kernel()->pm_stpa = Sysseg_pa;	pmap_kernel()->pm_stab = Sysseg;	pmap_kernel()->pm_ptab = Sysmap;#if defined(M68040) || defined(M68060)	if (mmutype == MMU_68040) {		pmap_ishift = SG4_SHIFT1;		pmap_kernel()->pm_stfree = protostfree;	} else		pmap_ishift = SG_ISHIFT;#endif	simple_lock_init(&pmap_kernel()->pm_lock);	pmap_kernel()->pm_count = 1;	/*	 * Allocate all the submaps we need	 */#define	SYSMAP(c, p, v, n)	\	v = (c)va; va += ((n)*NBPG); p = pte; pte += (n);	va = virtual_avail;	pte = pmap_pte(pmap_kernel(), va);	SYSMAP(caddr_t		,CMAP1		,CADDR1	   ,1		)	SYSMAP(caddr_t		,CMAP2		,CADDR2	   ,1		)	SYSMAP(caddr_t		,vmpte		,vmmap	   ,1		)	SYSMAP(struct msgbuf *	,msgbufmap	,msgbufp   ,btoc(MSGBUFSIZE))		DCIS();	virtual_avail = reserve_dumppages(va);}