pmap_update(pmap_kernel());
cpu_startup(){	unsigned i;	caddr_t v;	int sz;	int base, residual;#ifdef DEBUG	extern int pmapdebug;	int opmapdebug = pmapdebug;#endif	vaddr_t minaddr, maxaddr;	vsize_t size;	extern struct user *proc0paddr;#ifdef DEBUG	pmapdebug = 0;#endif	/*	 * fix message buffer mapping, note phys addr of msgbuf is 0	 */	pmap_map(MSGBUF_VA, 0, MSGBUFSIZE, VM_PROT_READ|VM_PROT_WRITE);	initmsgbuf((caddr_t)(MSGBUF_VA + (CPU_ISSUN4 ? 4096 : 0)), MSGBUFSIZE);	proc0.p_addr = proc0paddr;	/*	 * Good {morning,afternoon,evening,night}.	 */	printf(version);	/*identifycpu();*/	printf("real mem = %d\n", ctob(physmem));	/*	 * Find out how much space we need, allocate it,	 * and then give everything true virtual addresses.	 */	sz = (int)allocsys((caddr_t)0);	if ((v = (caddr_t)uvm_km_alloc(kernel_map, round_page(sz))) == 0)		panic("startup: no room for tables");	if (allocsys(v) - v != sz)		panic("startup: table size inconsistency");        /*         * allocate virtual and physical memory for the buffers.         */        size = MAXBSIZE * nbuf;         /* # bytes for buffers */        /* allocate VM for buffers... area is not managed by VM system */        if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size),                    NULL, UVM_UNKNOWN_OFFSET, 0,                    UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,                                UVM_ADV_NORMAL, 0)))        	panic("cpu_startup: cannot allocate VM for buffers");        minaddr = (vaddr_t) buffers;        if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {        	bufpages = btoc(MAXBSIZE) * nbuf; /* do not overallocate RAM */        }        base = bufpages / nbuf;        residual = bufpages % nbuf;        /* now allocate RAM for buffers */	for (i = 0 ; i < nbuf ; i++) {		vaddr_t curbuf;		vsize_t curbufsize;		struct vm_page *pg;		/*		 * each buffer has MAXBSIZE bytes of VM space allocated.  of		 * that MAXBSIZE space we allocate and map (base+1) pages		 * for the first "residual" buffers, and then we allocate		 * "base" pages for the rest.		 */		curbuf = (vaddr_t) buffers + (i * MAXBSIZE);		curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base);		while (curbufsize) {			pg = uvm_pagealloc(NULL, 0, NULL, 0);			if (pg == NULL)				panic("cpu_startup: "				    "not enough RAM for buffer cache");			pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),				VM_PROT_READ|VM_PROT_WRITE);			curbuf += PAGE_SIZE;			curbufsize -= PAGE_SIZE;		}	}	pmap_update(pmap_kernel());	/*	 * Allocate a submap for exec arguments.  This map effectively	 * limits the number of processes exec'ing at any time.	 */	exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,				 16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);	/*	 * Allocate a map for physio.  Others use a submap of the kernel	 * map, but we want one completely separate, even though it uses	 * the same pmap.	 */	dvma_base = CPU_ISSUN4M ? DVMA4M_BASE : DVMA_BASE;	dvma_end = CPU_ISSUN4M ? DVMA4M_END : DVMA_END;	phys_map = uvm_map_create(pmap_kernel(), dvma_base, dvma_end, 1);	if (phys_map == NULL)		panic("unable to create DVMA map");	/*	 * Allocate DVMA space and dump into a privately managed	 * resource map for double mappings which is usable from	 * interrupt contexts.	 */	if (uvm_km_valloc_wait(phys_map, (dvma_end-dvma_base)) != dvma_base)		panic("unable to allocate from DVMA map");	dvmamap_extent = extent_create("dvmamap", dvma_base, dvma_end,				       M_DEVBUF, NULL, 0, EX_NOWAIT);	if (dvmamap_extent == 0)		panic("unable to allocate extent for dvma");	mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,				 VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);#ifdef DEBUG	pmapdebug = opmapdebug;#endif	printf("avail mem = %ld\n", ptoa(uvmexp.free));	printf("using %d buffers containing %d bytes of memory\n",		nbuf, bufpages * PAGE_SIZE);	/*	 * Set up buffers, so they can be used to read disk labels.	 */	bufinit();}