Dear Terry, >See /usr/src/sys/kernel.h. It is done using linker sets and >SYSINIT. Hmm��. Thank you! I find the mi_startup() function in /sys/kern/init_main.c, there are some code as follow: for (sipp = sysinit; sipp < sysinit_end; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) continue; /* skip dummy task(s)*/ if ((*sipp)->subsystem == SI_SUB_DONE) continue; /* Call function */ (*((*sipp)->func))((*sipp)->udata); /* Check off the one we're just done */ (*sipp)->subsystem = SI_SUB_DONE; /* Check if we've installed more sysinit items via KLD */ if (newsysinit != NULL) { if (sysinit != SET_BEGIN(sysinit_set)) free(sysinit, M_TEMP); sysinit = newsysinit; sysinit_end = newsysinit_end; newsysinit = NULL; newsysinit_end = NULL; goto restart; } } Now, I am puzzled about the function pointer(func), which is how to work. For example, I have a NIC ��fxp0��, so the function pointer should point to the fxp_attach? If that is right, I want to know how the kernel call the mi_startup()? Best Regards Ouyang Kai Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com |
Dear Terry
>See /usr/src/sys/kernel.h. It is done using linker sets and
>SYSINIT.
Hmm��. Thank you!
I find the mi_startup() function in /sys/kern/init_main.c, there are some code as
follow:
for (sipp = sysinit; sipp < sysinit_end; sipp++) {
if ((*sipp)->subsystem == SI_SUB_DUMMY)
continue; /* skip dummy task(s)*/
if ((*sipp)->subsystem == SI_SUB_DONE)
continue;
/* Call function */
(*((*sipp)->func))((*sipp)->udata);
/* Check off the one we're just done */
(*sipp)->subsystem = SI_SUB_DONE;
/* Check if we've installed more sysinit items via KLD */
if (newsysinit != NULL) {
if (sysinit != SET_BEGIN(sysinit_set))
free(sysinit, M_TEMP);
sysinit = newsysinit;
sysinit_end = newsysinit_end;
newsysinit = NULL;
newsysinit_end = NULL;
goto restart;
}
}
Now, I am puzzled about the function pointer(func), which is how to work.
For example, I have a NIC ��fxp0��, so the function pointer should point to the
fxp_attach?
Best Regards
Ouyang Kai
If that is right, I want to know how the kernel call the mi_startup()?

