if (boothowto & RB_CONFIG) { #ifdef BOOT_CONFIG user_config(); #else printf("kernel does not support -c; continuing..\n"); #endif }
cpu_startup(){	caddr_t v;	int sz, i;	vm_size_t size;    	int base, residual;#if defined(UVM)	vaddr_t minaddr, maxaddr, uarea_pages, addr;	extern char   *kernel_text, *etext;#else	vm_offset_t minaddr, maxaddr, uarea_pages;#endif 	extern vm_offset_t miniroot;	/*	 * Initialize error message buffer (at end of core).	 * avail_end was pre-decremented in mvme_bootstrap().	 */	for (i = 0; i < btoc(MSGBUFSIZE); i++)		pmap_enter(kernel_pmap, (vm_offset_t)msgbufp,			   avail_end + i * NBPG, VM_PROT_READ|VM_PROT_WRITE,			   VM_PROT_READ|VM_PROT_WRITE, TRUE);	initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE));	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 defined(UVM)	if ((v = (caddr_t)uvm_km_zalloc(kernel_map, m88k_round_page(sz))) == 0)#else	if ((v = (caddr_t)kmem_alloc(kernel_map, m88k_round_page(sz))) == 0)#endif		panic("startup: no room for tables");	if (allocsys(v) - v != sz)		panic("startup: table size inconsistency");	/*	 * Grab UADDR virtual address	 */	uarea_pages = UADDR;#if defined(UVM)	uvm_map(kernel_map, (vaddr_t *)&uarea_pages, USPACE,		NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, 						     UVM_PROT_NONE,						     UVM_INH_NONE,						     UVM_ADV_NORMAL, 0));#else	vm_map_find(kernel_map, vm_object_allocate(USPACE), 0,		    (vm_offset_t *)&uarea_pages, USPACE, TRUE);#endif	if (uarea_pages != UADDR) {		printf("uarea_pages %x: UADDR not free\n", uarea_pages);		panic("bad UADDR");	}		/* 	 * Grab machine dependant memory spaces	 */	switch (cputyp) {#ifdef MVME187	case CPU_187:#endif #ifdef MVME197	case CPU_197:#endif #if defined(MVME187) || defined(MVME197)		/*		 * Grab the BUGROM space that we hardwired in pmap_bootstrap		 */		bugromva = BUGROM_START;#if defined(UVM)		uvm_map(kernel_map, (vaddr_t *)&bugromva, BUGROM_SIZE,			NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, 							     UVM_PROT_NONE,							     UVM_INH_NONE,							     UVM_ADV_NORMAL, 0));#else		vm_map_find(kernel_map, vm_object_allocate(BUGROM_SIZE), 0,			    (vm_offset_t *)&bugromva, BUGROM_SIZE, TRUE);#endif		if (bugromva != BUGROM_START) {			printf("bugromva %x: BUGROM not free\n", bugromva);			panic("bad bugromva");		}				/*		 * Grab the SRAM space that we hardwired in pmap_bootstrap		 */		sramva = SRAM_START;#if defined(UVM)		uvm_map(kernel_map, (vaddr_t *)&sramva, SRAM_SIZE,			NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, 							     UVM_PROT_NONE,							     UVM_INH_NONE,							     UVM_ADV_NORMAL, 0));#else		vm_map_find(kernel_map, vm_object_allocate(SRAM_SIZE), 0,			    (vm_offset_t *)&sramva, SRAM_SIZE, TRUE);#endif		if (sramva != SRAM_START) {			printf("sramva %x: SRAM not free\n", sramva);			panic("bad sramva");		}		/*		 * Grab the OBIO space that we hardwired in pmap_bootstrap		 */		obiova = OBIO_START;#if defined(UVM)		uvm_map(kernel_map, (vaddr_t *)&obiova, OBIO_SIZE,			NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, 							     UVM_PROT_NONE,							     UVM_INH_NONE,							     UVM_ADV_NORMAL, 0));#else		vm_map_find(kernel_map, vm_object_allocate(OBIO_SIZE), 0,			    (vm_offset_t *)&obiova, OBIO_SIZE, TRUE);#endif		if (obiova != OBIO_START) {			printf("obiova %x: OBIO not free\n", obiova);			panic("bad OBIO");		}		break;#endif #ifdef MVME188	case CPU_188:		/*		 * Grab the UTIL space that we hardwired in pmap_bootstrap		 */		utilva = MVME188_UTILITY;#if defined(UVM)		uvm_map(kernel_map, (vaddr_t *)&utilva, MVME188_UTILITY_SIZE,			NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, 							     UVM_PROT_NONE,							     UVM_INH_NONE,							     UVM_ADV_NORMAL, 0));#else		vm_map_find(kernel_map, vm_object_allocate(MVME188_UTILITY_SIZE), 0,			    (vm_offset_t *)&utilva, MVME188_UTILITY_SIZE, TRUE);#endif		if (utilva != MVME188_UTILITY) {			printf("utilva %x: UTILITY area not free\n", utilva);			panic("bad utilva");		}		break;#endif	default:		panic("startup: unknown cpu type.");	}	/*	 * Now allocate buffers proper.  They are different than the above	 * in that they usually occupy more virtual memory than physical.	 */	size = MAXBSIZE * nbuf;#if defined(UVM)	if (uvm_map(kernel_map, (vaddr_t *) &buffers, m88k_round_page(size),		    NULL, UVM_UNKNOWN_OFFSET,		    UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,				UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)		panic("cpu_startup: cannot allocate VM for buffers");	minaddr = (vaddr_t)buffers;#else	buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,				   &maxaddr, size, TRUE);	minaddr = (vm_offset_t)buffers;	if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,	    (vm_offset_t *)&minaddr, size, FALSE) != KERN_SUCCESS)		panic("startup: cannot allocate buffers");#endif	if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {		/* don't want to alloc more physical mem than needed */		bufpages = btoc(MAXBSIZE) * nbuf;	}	base = bufpages / nbuf;	residual = bufpages % nbuf;	for (i = 0; i < nbuf; i++) {#if defined(UVM)		vsize_t curbufsize;		vaddr_t curbuf;		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 = (vm_offset_t) buffers + (i * MAXBSIZE);		curbufsize = CLBYTES * ((i < residual) ? (base+1) : base);		while (curbufsize) {			pg = uvm_pagealloc(NULL, 0, NULL, 0);			if (pg == NULL)				panic("cpu_startup: not enough memory for "				      "buffer cache");			pmap_enter(kernel_map->pmap, curbuf,				   VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE,				   VM_PROT_READ|VM_PROT_WRITE);			curbuf += PAGE_SIZE;			curbufsize -= PAGE_SIZE;		}#else		vm_size_t curbufsize;		vm_offset_t curbuf;		/*		 * First <residual> buffers get (base+1) physical pages		 * allocated for them.  The rest get (base) physical pages.		 *		 * The rest of each buffer occupies virtual space,		 * but has no physical memory allocated for it.		 */		curbuf = (vm_offset_t)buffers + i * MAXBSIZE;		curbufsize = CLBYTES * (i < residual ? base+1 : base);		/* this faults in the required physical pages */		vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);		vm_map_simplify(buffer_map, curbuf);#endif 	}	/*	 * Allocate a submap for exec arguments.  This map effectively	 * limits the number of processes exec'ing at any time.	 */#if defined(UVM)	exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,				   16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);#else	exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,				 16*NCARGS, TRUE);#endif	#ifdef DEBUG	printf("exe_map from 0x%x to 0x%x\n", (unsigned)minaddr, (unsigned)maxaddr);#endif 	/*	 * Allocate map for physio.	 */#if defined(UVM)	phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,				   VM_PHYS_SIZE, 0, FALSE, NULL);#else	phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, 				 VM_PHYS_SIZE, TRUE);#endif	if (phys_map == NULL) {		panic("cpu_startup: unable to create phys_map");	}	/* 	 * Allocate map for external I/O XXX new code - smurph 	 */#if defined(UVM)	iomap_map = uvm_km_suballoc(kernel_map, &iomapbase, &maxaddr,				   IOMAP_SIZE, 0, FALSE, NULL);#else	iomap_map = kmem_suballoc(kernel_map, &iomapbase, &maxaddr, 				  IOMAP_SIZE, TRUE);#endif 	if (iomap_map == NULL) {		panic("cpu_startup: unable to create iomap_map");	}	rminit(iomap, IOMAP_SIZE, (u_long)iomapbase, "iomap", NIOPMAP);	/*	 * Finally, allocate mbuf pool.  Since mclrefcnt is an off-size	 * we use the more space efficient malloc in place of kmem_alloc.	 */	mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,				   M_MBUF, M_NOWAIT);	bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);#if defined(UVM)	mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr,				 VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);#else	mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,			       VM_MBUF_SIZE, FALSE);#endif		/*	 * Initialize timeouts	 */	timeout_init();#if defined(UVM)	printf("avail mem = %ld (%ld pages)\n", ptoa(uvmexp.free), uvmexp.free);#else	printf("avail mem = %ld (%ld pages)\n", ptoa(cnt.v_free_count),	    ptoa(cnt.v_free_count)/NBPG);#endif	printf("using %d buffers containing %d bytes of memory\n", nbuf,	    bufpages * CLBYTES);#if 0 /* #ifdef MFS */	/*	 * Check to see if a mini-root was loaded into memory. It resides	 * at the start of the next page just after the end of BSS.	 */	{		extern void *smini;		if (miniroot && (boothowto & RB_MINIROOT)) {			boothowto |= RB_DFLTROOT;			mfs_initminiroot(miniroot);		}	}#endif	/*	 * Set up buffers, so they can be used to read disk labels.	 */	bufinit();	/*	 * Configure the system.	 */	nofault = NULL;	/*	 * zero out intr_handlers	 */	bzero((void *)intr_handlers, 256 * sizeof(struct intrhand *));	setupiackvectors();	configure();}