mem_layout[i].mem_size -= 0x8000 - mem_layout[i].mem_start; mem_layout[i].mem_start = 0x8000;
mem_layout[i].mem_size -= 0x20000 - mem_layout[i].mem_start; mem_layout[i].mem_start = 0x20000;
pmap_bootstrap(firstaddr)	vm_offset_t firstaddr;{	register int i, n, nextpage;	register pt_entry_t *spte;	struct physseg *pseg;	vm_offset_t start = firstaddr;	extern int physmem;/*XXX*/	char pbuf[100];#define	valloc(name, type, num) \	    (name) = (type *)firstaddr; firstaddr = (vm_offset_t)((name)+(num))	/*	 * Allocate a PTE table for the kernel.	 * The '1024' comes from PAGER_MAP_SIZE in vm_pager_init().	 * This should be kept in sync.	 * We also reserve space for kmem_alloc_pageable() for vm_fork().	 */	Sysmapsize = (VM_KMEM_SIZE + VM_MBUF_SIZE + VM_PHYS_SIZE +		nbuf * MAXBSIZE + 16 * NCARGS) / NBPG + 1024 + 256;	Sysmapsize += maxproc * UPAGES * 2;#ifdef SYSVSHM	Sysmapsize += shminfo.shmall;#endif	valloc(Sysmap, pt_entry_t, Sysmapsize);#ifdef ATTR	valloc(pmap_attributes, char, physmem);#endif	/*	 * Allocate memory for pv_table.	 * This will allocate more entries than we really need.	 * We could do this in pmap_init when we know the actual	 * phys_start and phys_end but its better to use kseg0 addresses	 * rather than kernel virtual addresses mapped through the TLB.	 */#ifdef MACHINE_NONCONTIG	i = 0;	for( n = 0; n < MAXMEMSEGS; n++) {		i += mips_btop(mem_layout[n].mem_size);	}#else	i = physmem - mips_btop(CACHED_TO_PHYS(firstaddr));#endif /*MACHINE_NONCONTIG*/	valloc(pv_table, struct pv_entry, i);	/*	 * Clear allocated memory.	 */	firstaddr = mips_round_page(firstaddr);	bzero((caddr_t)start, firstaddr - start);	avail_start = CACHED_TO_PHYS(firstaddr);	avail_end = mips_ptob(physmem);#ifdef MACHINE_NONCONTIG	avail_remaining = 0;	nextpage = 0;	/*	 * Now set up memory areas. Be careful to remove areas used         * for the OS and for exception vector stuff.         */	pseg = &physsegs[0];	for( i = 0; i < MAXMEMSEGS; i++) {		/* Adjust for the kernel exeption vectors and sys data area */		if(mem_layout[i].mem_start < 0x8000) { 			if((mem_layout[i].mem_start + mem_layout[i].mem_size) < 0x8000)				continue;	/* To small skip it */			mem_layout[i].mem_size -= 0x8000 - mem_layout[i].mem_start;			mem_layout[i].mem_start = 0x8000;  /* Adjust to be above vec's */		}		/* Adjust for the kernel expansion area (bufs etc) */		if((mem_layout[i].mem_start + mem_layout[i].mem_size > CACHED_TO_PHYS(_ftext)) && 		   (mem_layout[i].mem_start < CACHED_TO_PHYS(avail_start))) { 			mem_layout[i].mem_size -= CACHED_TO_PHYS(avail_start) - mem_layout[i].mem_start;			mem_layout[i].mem_start = CACHED_TO_PHYS(avail_start);		}		if(mem_layout[i].mem_size == 0)			continue;		pseg->start = mem_layout[i].mem_start;		pseg->end = pseg->start + mem_layout[i].mem_size;		pseg->first_page = nextpage;		nextpage += (pseg->end - pseg->start) / NBPG;		avail_remaining += (pseg->end - pseg->start) / NBPG;/*XXX*/	sprintf(pbuf,"segment = %d start 0x%x end 0x%x avail %d page %d\n", i, pseg->start, pseg->end, avail_remaining, nextpage); bios_putstring(pbuf);		pseg++;	}	avail_next = physsegs[0].start;#endif /* MACHINE_NONCONTIG */	virtual_avail = VM_MIN_KERNEL_ADDRESS;	virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG;	/* XXX need to decide how to set cnt.v_page_size */	simple_lock_init(&pmap_kernel()->pm_lock);	pmap_kernel()->pm_count = 1;	/*	 * The R4?00 stores only one copy of the Global bit in the	 * translation lookaside buffer for each 2 page entry. 	 * Thus invalid entrys must have the Global bit set so	 * when Entry LO and Entry HI G bits are anded together	 * they will produce a global bit to store in the tlb.	 */	for(i = 0, spte = Sysmap; i < Sysmapsize; i++, spte++)		spte->pt_entry = PG_G;}