* System startup; initialize the world, create process 0, mount root * filesystem, and fork to create init and pagedaemon. Most of the * hard work is done in the lower-level initialization routines including * startup(), which does memory initialization and autoconfiguration. * * This allows simple addition of new kernel subsystems that require * boot time initialization. It also allows su
| 227 | * module. Finally, it allows for optional "kernel threads". |
| 228 | */ |
| 229 | void |
| 230 | mi_startup(void) |
| 231 | { |
| 232 | |
| 233 | struct sysinit **sipp; /* system initialization*/ |
| 234 | struct sysinit **xipp; /* interior loop of sort*/ |
| 235 | struct sysinit *save; /* bubble*/ |
| 236 | |
| 237 | #if defined(VERBOSE_SYSINIT) |
| 238 | int last; |
| 239 | int verbose; |
| 240 | #endif |
| 241 | |
| 242 | TSENTER(); |
| 243 | |
| 244 | if (boothowto & RB_VERBOSE) |
| 245 | bootverbose++; |
| 246 | |
| 247 | if (sysinit == NULL) { |
| 248 | sysinit = SET_BEGIN(sysinit_set); |
| 249 | sysinit_end = SET_LIMIT(sysinit_set); |
| 250 | } |
| 251 | |
| 252 | restart: |
| 253 | /* |
| 254 | * Perform a bubble sort of the system initialization objects by |
| 255 | * their subsystem (primary key) and order (secondary key). |
| 256 | */ |
| 257 | for (sipp = sysinit; sipp < sysinit_end; sipp++) { |
| 258 | for (xipp = sipp + 1; xipp < sysinit_end; xipp++) { |
| 259 | if ((*sipp)->subsystem < (*xipp)->subsystem || |
| 260 | ((*sipp)->subsystem == (*xipp)->subsystem && |
| 261 | (*sipp)->order <= (*xipp)->order)) |
| 262 | continue; /* skip*/ |
| 263 | save = *sipp; |
| 264 | *sipp = *xipp; |
| 265 | *xipp = save; |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | #if defined(VERBOSE_SYSINIT) |
| 270 | last = SI_SUB_COPYRIGHT; |
| 271 | verbose = 0; |
| 272 | #if !defined(DDB) |
| 273 | printf("VERBOSE_SYSINIT: DDB not enabled, symbol lookups disabled.\n"); |
| 274 | #endif |
| 275 | #endif |
| 276 | |
| 277 | /* |
| 278 | * Traverse the (now) ordered list of system initialization tasks. |
| 279 | * Perform each task, and continue on to the next task. |
| 280 | */ |
| 281 | for (sipp = sysinit; sipp < sysinit_end; sipp++) { |
| 282 | if ((*sipp)->subsystem == SI_SUB_DUMMY) |
| 283 | continue; /* skip dummy task(s)*/ |
| 284 | |
| 285 | if ((*sipp)->subsystem == SI_SUB_DONE) |
| 286 | continue; |
nothing calls this directly
no test coverage detected