static int mas_master_daemon_main( const mas_options_t * popts, int argc, char *argv[], char *env[] ) { EVAL_PREPARE; int r = 0; mas_control_t *this = &ctrl; MSTAGE( DAEMON ); HMSG( "BUNCH DO DAEMON" ); IEVAL( r, mas_master_main( popts ) ); #ifdef MAS_TRACEMEM { extern unsigned long memory_balance; mMSG( "bunch end, memory_balance:%lu - Ticker:%lx;Logger:%lx;", memory_balance, ctrl.threads.n.ticker.thread, ctrl.threads.n.logger.thread ); MAS_LOG( "bunch end, m/b:%lu", memory_balance ); # if 0 if ( print_memlist( FL, ctrl.stderrfile ) < 0 ) if ( print_memlist( FL, ctrl.old_stderrfile ) < 0 ) if ( print_memlist( FL, ctrl.msgfile ) < 0 ) print_memlist( FL, stderr ); # endif } #endif mas_thself_set_name( popts->thname.daemon_bunchx, "zocDaeBunchX" ); return r; }
caddr_t resalloc(enum RESOURCES type, size_t bytes, caddr_t virthint, int align) { caddr_t vaddr; long pmap = 0; if (memlistpage == (caddr_t)0) reset_alloc(); if (bytes == 0) return ((caddr_t)0); /* extend request to fill a page */ bytes = roundup(bytes, pagesize); dprintf("resalloc: bytes = %lu\n", bytes); switch (type) { /* * even V2 PROMs never bother to indicate whether the * first MAPPEDMEM_MINTOP is taken or not. So we do it all here. * Smart PROM or no smart PROM. */ case RES_BOOTSCRATCH: case RES_BOOTSCRATCH_NOFAIL: vaddr = get_low_vpage((bytes/pagesize), type); if (resalloc_debug) { dprintf("vaddr = %p, paddr = %lx\n", (void *)vaddr, ptob(pmap)); print_memlist(vfreelistp); print_memlist(pfreelistp); } return (vaddr); /*NOTREACHED*/ case RES_CHILDVIRT: vaddr = (caddr_t)prom_alloc(virthint, bytes, align); if (vaddr == (caddr_t)virthint) return (vaddr); printf("Alloc of 0x%lx bytes at 0x%p refused.\n", bytes, (void *)virthint); return ((caddr_t)0); /*NOTREACHED*/ default: printf("Bad resurce type\n"); return ((caddr_t)0); } }
void mas_atexit( void ) { if ( configuration.flags.verbose > 2 ) printf( "at exit\n" ); runonce_delete( ); #ifdef MAS_TRACEMEM print_memlist( FL, stderr ); #endif }
int main( void ) { #ifdef MAS_TRACEMEM print_memlist( stderr, FL ); #endif return 0; }
/*ARGSUSED*/ int main(void *cookie, char **argv, int argc) { /* * bpath is the boot device path buffer. * bargs is the boot arguments buffer. */ static char bpath[OBP_MAXPATHLEN], bargs[OBP_MAXPATHLEN]; boolean_t user_specified_filename; prom_init("boot", cookie); fiximp(); system_check(); dprintf("\nboot: V%d /boot interface.\n", BO_VERSION); #ifdef HALTBOOT prom_enter_mon(); #endif /* HALTBOOT */ init_memlists(); #ifdef DEBUG_LISTS dprintf("Physmem avail:\n"); if (debug) print_memlist(pfreelistp); dprintf("Virtmem avail:\n"); if (debug) print_memlist(vfreelistp); dprintf("Phys installed:\n"); if (debug) print_memlist(pinstalledp); prom_enter_mon(); #endif /* DEBUG_LISTS */ /* * Initialize the default filename (exported as "default-name" and * used by kadb). */ set_default_filename(defname); /* * Parse the arguments ASAP in case there are any flags which may * affect execution. */ /* * filename is the path to the standalone. Initialize it to the empty * string so we can tell whether the user specified it in the * arguments. */ filename[0] = '\0'; /* * Fetch the boot arguments from the PROM and split the filename off * if it's there. */ init_bootargs(filename, sizeof (filename), bargs, sizeof (bargs)); /* * kadb was delivered as a standalone, and as such, people got used to * typing `boot kadb'. kmdb isn't a standalone - it is loaded by krtld * as just another kernel module. For compatibility, though, when we * see an attempt to `boot kadb' or `boot kmdb', we'll transform that * into a `boot -k' (or equivalent). */ if (strcmp(filename, "kmdb") == 0 || strcmp(filename, "kadb") == 0) { boothowto |= RB_KMDB; *filename = '\0'; /* let boot figure out which unix to use */ } bootflags(bargs, sizeof (bargs)); user_specified_filename = (filename[0] != '\0'); /* Fetch the boot path from the PROM. */ (void) strncpy(bpath, prom_bootpath(), sizeof (bpath) - 1); bpath[sizeof (bpath) - 1] = '\0'; dprintf("arch: %s\n", is_sun4v ? "sun4v" : "sun4u"); dprintf("bootpath: 0x%p %s\n", (void *)bpath, bpath); dprintf("bootargs: 0x%p %s\n", (void *)bargs, bargs); dprintf("filename: 0x%p %s\n", (void *)filename, filename); dprintf("kernname: 0x%p %s\n", (void *)kernname, kernname); /* * *v2path will be exported to the standalone as the boot-path boot * property. */ v2path = bpath; /* * Our memory lists should be "up" by this time */ setup_bootops(); /* * If bpath is a network card, set v2path to a copy of bpath with the * options stripped off. */ mangle_os_bootpath(bpath); /* * Not necessary on sun4v as nvram is virtual * and kept by the guest manager on the SP. */ if (!is_sun4v) { retain_nvram_page(); } if (bootprog(bpath, bargs, user_specified_filename) == 0) { post_mountroot(filename, NULL); /*NOTREACHED*/ } return (0); }