Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/init_main.c
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
#include "opt_ddb.h" | #include "opt_ddb.h" | ||||
#include "opt_kdb.h" | #include "opt_kdb.h" | ||||
#include "opt_init_path.h" | #include "opt_init_path.h" | ||||
#include "opt_verbose_sysinit.h" | #include "opt_verbose_sysinit.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/boottrace.h> | |||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/cpuset.h> | #include <sys/cpuset.h> | ||||
#include <sys/dtrace_bsd.h> | #include <sys/dtrace_bsd.h> | ||||
#include <sys/epoch.h> | #include <sys/epoch.h> | ||||
#include <sys/eventhandler.h> | #include <sys/eventhandler.h> | ||||
#include <sys/exec.h> | #include <sys/exec.h> | ||||
#include <sys/file.h> | #include <sys/file.h> | ||||
#include <sys/filedesc.h> | #include <sys/filedesc.h> | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
mi_startup(void) | mi_startup(void) | ||||
{ | { | ||||
struct sysinit **sipp; /* system initialization*/ | struct sysinit **sipp; /* system initialization*/ | ||||
struct sysinit **xipp; /* interior loop of sort*/ | struct sysinit **xipp; /* interior loop of sort*/ | ||||
struct sysinit *save; /* bubble*/ | struct sysinit *save; /* bubble*/ | ||||
#if defined(VERBOSE_SYSINIT) | |||||
int last; | int last; | ||||
#if defined(VERBOSE_SYSINIT) | |||||
int verbose; | int verbose; | ||||
#endif | #endif | ||||
TSENTER(); | TSENTER(); | ||||
if (boothowto & RB_VERBOSE) | if (boothowto & RB_VERBOSE) | ||||
bootverbose++; | bootverbose++; | ||||
Show All 14 Lines | for (xipp = sipp + 1; xipp < sysinit_end; xipp++) { | ||||
(*sipp)->order <= (*xipp)->order)) | (*sipp)->order <= (*xipp)->order)) | ||||
continue; /* skip*/ | continue; /* skip*/ | ||||
save = *sipp; | save = *sipp; | ||||
*sipp = *xipp; | *sipp = *xipp; | ||||
*xipp = save; | *xipp = save; | ||||
} | } | ||||
} | } | ||||
#if defined(VERBOSE_SYSINIT) | |||||
last = SI_SUB_COPYRIGHT; | last = SI_SUB_COPYRIGHT; | ||||
#if defined(VERBOSE_SYSINIT) | |||||
verbose = 0; | verbose = 0; | ||||
#if !defined(DDB) | #if !defined(DDB) | ||||
printf("VERBOSE_SYSINIT: DDB not enabled, symbol lookups disabled.\n"); | printf("VERBOSE_SYSINIT: DDB not enabled, symbol lookups disabled.\n"); | ||||
#endif | #endif | ||||
#endif | #endif | ||||
/* | /* | ||||
* Traverse the (now) ordered list of system initialization tasks. | * Traverse the (now) ordered list of system initialization tasks. | ||||
* Perform each task, and continue on to the next task. | * Perform each task, and continue on to the next task. | ||||
*/ | */ | ||||
for (sipp = sysinit; sipp < sysinit_end; sipp++) { | for (sipp = sysinit; sipp < sysinit_end; sipp++) { | ||||
if ((*sipp)->subsystem == SI_SUB_DUMMY) | if ((*sipp)->subsystem == SI_SUB_DUMMY) | ||||
continue; /* skip dummy task(s)*/ | continue; /* skip dummy task(s)*/ | ||||
if ((*sipp)->subsystem == SI_SUB_DONE) | if ((*sipp)->subsystem == SI_SUB_DONE) | ||||
continue; | continue; | ||||
if ((*sipp)->subsystem > last) | |||||
BOOTTRACE_INIT("sysinit 0x%7x", (*sipp)->subsystem); | |||||
#if defined(VERBOSE_SYSINIT) | #if defined(VERBOSE_SYSINIT) | ||||
if ((*sipp)->subsystem > last && verbose_sysinit != 0) { | if ((*sipp)->subsystem > last && verbose_sysinit != 0) { | ||||
verbose = 1; | verbose = 1; | ||||
last = (*sipp)->subsystem; | |||||
printf("subsystem %x\n", last); | printf("subsystem %x\n", last); | ||||
} | } | ||||
if (verbose) { | if (verbose) { | ||||
#if defined(DDB) | #if defined(DDB) | ||||
const char *func, *data; | const char *func, *data; | ||||
func = symbol_name((vm_offset_t)(*sipp)->func, | func = symbol_name((vm_offset_t)(*sipp)->func, | ||||
DB_STGY_PROC); | DB_STGY_PROC); | ||||
Show All 14 Lines | #endif | ||||
(*((*sipp)->func))((*sipp)->udata); | (*((*sipp)->func))((*sipp)->udata); | ||||
#if defined(VERBOSE_SYSINIT) | #if defined(VERBOSE_SYSINIT) | ||||
if (verbose) | if (verbose) | ||||
printf("done.\n"); | printf("done.\n"); | ||||
#endif | #endif | ||||
/* Check off the one we're just done */ | /* Check off the one we're just done */ | ||||
last = (*sipp)->subsystem; | |||||
(*sipp)->subsystem = SI_SUB_DONE; | (*sipp)->subsystem = SI_SUB_DONE; | ||||
/* Check if we've installed more sysinit items via KLD */ | /* Check if we've installed more sysinit items via KLD */ | ||||
if (newsysinit != NULL) { | if (newsysinit != NULL) { | ||||
if (sysinit != SET_BEGIN(sysinit_set)) | if (sysinit != SET_BEGIN(sysinit_set)) | ||||
free(sysinit, M_TEMP); | free(sysinit, M_TEMP); | ||||
sysinit = newsysinit; | sysinit = newsysinit; | ||||
sysinit_end = newsysinit_end; | sysinit_end = newsysinit_end; | ||||
newsysinit = NULL; | newsysinit = NULL; | ||||
newsysinit_end = NULL; | newsysinit_end = NULL; | ||||
goto restart; | goto restart; | ||||
} | } | ||||
} | } | ||||
TSEXIT(); /* Here so we don't overlap with start_init. */ | TSEXIT(); /* Here so we don't overlap with start_init. */ | ||||
BOOTTRACE("mi_startup done"); | |||||
mtx_assert(&Giant, MA_OWNED | MA_NOTRECURSED); | mtx_assert(&Giant, MA_OWNED | MA_NOTRECURSED); | ||||
mtx_unlock(&Giant); | mtx_unlock(&Giant); | ||||
/* | /* | ||||
* Now hand over this thread to swapper. | * Now hand over this thread to swapper. | ||||
*/ | */ | ||||
swapper(); | swapper(); | ||||
▲ Show 20 Lines • Show All 558 Lines • Show Last 20 Lines |