if (ctob(physmem) > 31*1024*1024 && MAXKPDE != NKPDE) { vm_offset_t p; int i;  p = pmap_steal_memory((MAXKPDE-NKPDE+1) * NBPG); bzero((void *)p, (MAXKPDE-NKPDE+1) * NBPG); p = round_page(p); for (i = NKPDE; i < MAXKPDE; i++, p += NBPG) PTD[KPTDI+i] = (pd_entry_t)p | PG_V | PG_KW; }
pmap_bootstrap(virtual_start)	vm_offset_t virtual_start;{#if BSDVM_COMPAT	vm_offset_t va;	pt_entry_t *pte;#endif	/* XXX: allow for msgbuf */	avail_end -= i386_round_page(sizeof(struct msgbuf));	virtual_avail = virtual_start;	virtual_end = VM_MAX_KERNEL_ADDRESS;	/*	 * Initialize protection array.	 */	i386_protection_init();#ifdef notdef	/*	 * Create Kernel page directory table and page maps.	 * [ currently done in locore. i have wild and crazy ideas -wfj ]	 */	bzero(firstaddr, (1+NKPDE)*NBPG);	pmap_kernel()->pm_pdir = firstaddr + VM_MIN_KERNEL_ADDRESS;	pmap_kernel()->pm_ptab = firstaddr + VM_MIN_KERNEL_ADDRESS + NBPG;	firstaddr += NBPG;	for (x = i386_btod(VM_MIN_KERNEL_ADDRESS);	     x < i386_btod(VM_MIN_KERNEL_ADDRESS) + NKPDE; x++) {		pd_entry_t *pde;		pde = pmap_kernel()->pm_pdir + x;		*pde = (firstaddr + x*NBPG) | PG_V | PG_KW;	}#else	pmap_kernel()->pm_pdir =	    (pd_entry_t *)(proc0.p_addr->u_pcb.pcb_cr3 + KERNBASE);#endif	simple_lock_init(&pmap_kernel()->pm_lock);	pmap_kernel()->pm_count = 1;#if BSDVM_COMPAT	/*	 * 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		,XXX_mmap	,vmmap	   ,1		)	SYSMAP(struct msgbuf *	,msgbufmap	,msgbufp   ,1		)	virtual_avail = va;#endif	/*	 * Reserve pmap space for mapping physical pages during dump.	 */	virtual_avail = reserve_dumppages(virtual_avail);	/*	 * reserve special hunk of memory for use by bus dma as a bounce	 * buffer (contiguous virtual *and* physical memory).  XXX	 */#if NISA > 0 && NISADMA > 0	if (ctob(physmem) >= 0x1000000) {		isaphysmem = pmap_steal_memory(DMA_BOUNCE * NBPG);		isaphysmempgs = DMA_BOUNCE;	} else {		isaphysmem = pmap_steal_memory(DMA_BOUNCE_LOW * NBPG);		isaphysmempgs = DMA_BOUNCE_LOW;	}#endif	pmap_update();}