sdt = SDTENT(map, virt);
sdt = SDTENT(kernel_pmap, virt);
pt_entry_t *pmap_expand_kmap __P((vm_offset_t, vm_prot_t));void pmap_free_tables __P((pmap_t));void pmap_remove_range __P((pmap_t, vm_offset_t, vm_offset_t));void pmap_copy_on_write __P((vm_offset_t));void pmap_expand __P((pmap_t, vm_offset_t));void cache_flush_loop __P((int, vm_offset_t, int));void pmap_pinit __P((pmap_t));void pmap_release __P((pmap_t));/* * Routine:	FLUSH_ATC_ENTRY * * Function: *	Flush atc(TLB) which maps given virtual address, in the CPUs which *	are specified by 'users', for the operating mode specified by *      'kernel'. * * Parameters: *	users	bit patterns of the CPUs which may hold the TLB, and *		should be flushed *	va	virtual address that should be flushed *      kernel  nonzero if supervisor mode, zero if user mode */void flush_atc_entry(long users, vm_offset_t va, boolean_t kernel){	register int cpu;	long tusers = users;#ifdef DIAGNOSTIC	if ((tusers != 0) && (ff1(tusers) >= MAX_CPUS)) {		printf("ff1 users = %d!\n", ff1(tusers));		panic("bogus amount of users!!!");	}#endif 	while ((cpu = ff1(tusers)) != 32) {		if (cpu_sets[cpu]) { /* just checking to make sure */			cmmu_flush_remote_tlb(cpu, kernel, va, PAGE_SIZE);		}		tusers &= ~(1 << cpu);	}}/* *	Convert machine-independent protection code to M88K protection bits. */unsigned intm88k_protection(pmap_t map, vm_prot_t prot){	pte_template_t p;	p.bits = 0;	p.pte.prot = (prot & VM_PROT_WRITE) ? 0 : 1;#ifdef M88110	if (cputyp == CPU_88110) {		p.pte.pg_used = 1;		p.pte.modified = p.pte.prot ? 0 : 1;		/* if the map is the kernel's map and since this 		 * is not a paged kernel, we go ahead and mark 		 * the page as modified to avoid an exception 		 * upon writing to the page the first time.  XXX smurph 		 */		if (map == kernel_pmap) { 			p.pte.modified = p.pte.prot ? 0 : 1;		}	}#endif 	return (p.bits);} /* m88k_protection *//* * Routine:	PMAP_PTE * * Function: *	Given a map and a virtual address, compute a (virtual) pointer *	to the page table entry (PTE) which maps the address . *	If the page table associated with the address does not *	exist, PT_ENTRY_NULL is returned (and the map may need to grow). * * Parameters: *	pmap	pointer to pmap structure *	virt	virtual address for which page table entry is desired * *    Otherwise the page table address is extracted from the segment table, *    the page table index is added, and the result is returned. * * Calls: *	SDTENT *	SDT_VALID *	PDT_IDX */pt_entry_t *pmap_pte(pmap_t map, vm_offset_t virt){	sdt_entry_t *sdt;#ifdef DIAGNOSTIC	/*XXX will this change if physical memory is not contiguous? */	/* take a look at PDTIDX XXXnivas */	if (map == PMAP_NULL)		panic("pmap_pte: pmap is NULL");#endif	sdt = SDTENT(map,virt);	/*	 * Check whether page table is exist or not.	 */	if (!SDT_VALID(sdt))		return (PT_ENTRY_NULL);	else		return ((pt_entry_t *)(((sdt + SDT_ENTRIES)->table_addr)<<PDT_SHIFT) +			PDTIDX(virt));} /* pmap_pte *//* * Routine:	PMAP_EXPAND_KMAP (internal) * * Function: *    Allocate a page descriptor table (pte_table) and validate associated * segment table entry, returning pointer to page table entry. This is * much like 'pmap_expand', except that table space is acquired * from an area set up by pmap_bootstrap, instead of through * uvm_km_zalloc. (Obviously, because uvm_km_zalloc uses the kernel map * for allocation - which we can't do when trying to expand the * kernel map!) Note that segment tables for the kernel map were * all allocated at pmap_bootstrap time, so we only need to worry * about the page table here. * * Parameters: *	virt	VA for which translation tables are needed *	prot	protection attributes for segment entries * * Extern/Global: *	kpdt_free	kernel page table free queue * * Calls: *	m88k_protection *	SDTENT *	SDT_VALID *	PDT_IDX * * This routine simply dequeues a table from the kpdt_free list, * initializes all its entries (invalidates them), and sets the * corresponding segment table entry to point to it. If the kpdt_free * list is empty - we panic (no other places to get memory, sorry). (Such * a panic indicates that pmap_bootstrap is not allocating enough table * space for the kernel virtual address space). * */pt_entry_t *pmap_expand_kmap(vm_offset_t virt, vm_prot_t prot){	int        aprot;	sdt_entry_t      *sdt;	kpdt_entry_t  kpdt_ent;	pmap_t     map = kernel_pmap;#ifdef DEBUG	if ((pmap_con_dbg & (CD_KMAP | CD_FULL)) == (CD_KMAP | CD_FULL))		printf("(pmap_expand_kmap :%x) v %x\n", curproc,virt);#endif	aprot = m88k_protection (map, prot);	/*  segment table entry derivate from map and virt. */	sdt = SDTENT(map, virt);	if (SDT_VALID(sdt))		panic("pmap_expand_kmap: segment table entry VALID");	kpdt_ent = kpdt_free;	if (kpdt_ent == KPDT_ENTRY_NULL) {		printf("pmap_expand_kmap: Ran out of kernel pte tables\n");		return (PT_ENTRY_NULL);	}	kpdt_free = kpdt_free->next;	/* physical table */	((sdt_entry_template_t *)sdt)->bits = kpdt_ent->phys | aprot | DT_VALID;	/* virtual table */	((sdt_entry_template_t *)(sdt + SDT_ENTRIES))->bits = (vm_offset_t)kpdt_ent | aprot | DT_VALID;	(unsigned)(kpdt_ent->phys) = 0;	(unsigned)(kpdt_ent->next) = 0;	return ((pt_entry_t *)(kpdt_ent) + PDTIDX(virt));}/* pmap_expand_kmap() */