void pmap_activate __P((register pmap_t));
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 */#endif#ifdef MACHINE_NONCONTIGstruct physeg {	vm_offset_t start;	vm_offset_t end;	int first_page;} phys_segs[16];static	vm_offset_t avail_next;static	vm_size_t avail_remaining;u_long	noncontig_enable;#endifextern 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));#ifdef MACHINE_NONCONTIG#define pmap_valid_page(pa)	(pmap_initialized && pmap_page_index(pa) >= 0)#else#define pmap_valid_page(pa)	(pmap_initialized && pa >= vm_first_phys && \				pa < vm_last_phys)#endifvoid pmap_activate __P((register pmap_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;struct msgbuf	*msgbufp;/* *	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;#ifdef MACHINE_NONCONTIG	int i;	struct boot_memseg *sp, *esp;#endif	avail_start = firstaddr;	avail_end = maxmem << PGSHIFT;	/* XXX: allow for msgbuf */	avail_end -= m68k_round_page(sizeof(struct msgbuf));#ifdef MACHINE_NONCONTIG	/*	 * first segment of memory is always the one loadbsd found	 * found for loading the kernel into.	 */	avail_next = avail_start;	avail_remaining = (avail_end - avail_start) >> PGSHIFT;	phys_segs[0].start = avail_start;	phys_segs[0].end = avail_end;	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 (avail_start >= sp->ms_start && avail_start <		    sp->ms_start + sp->ms_size)			continue;		/* skip kernel segment */		if (sp->ms_size == 0)			continue;		/* skip zero size segments */		phys_segs[i].start = sp->ms_start;		phys_segs[i].end = 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 (phys_segs[i].end == 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 ((phys_segs[i].start <= z2mem_start) &&		    (phys_segs[i].end > z2mem_start))			phys_segs[i].end = z2mem_start;		phys_segs[i].first_page = phys_segs[i - 1].first_page +		    (phys_segs[i - 1].end - phys_segs[i - 1].start) / NBPG;		avail_remaining +=		    (phys_segs[i].end - phys_segs[i].start) / NBPG;		physmem += (phys_segs[i].end - phys_segs[i].start) / NBPG;		++i;		if (noncontig_enable == 1)			break;		/* Only two segments enabled */	}#endif	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   ,1		)	virtual_avail = reserve_dumppages(va);}