Date: Mon, 12 Aug 2002 17:49:46 +0800 From: "ouyang kai" <oykai@msn.com> To: "Lambert Terry" <tlambert2@mindspring.com>, <freebsd-hackers@FreeBSD.ORG> Subject: Re: Hi, how the kernel add the devices Message-ID: <OE72Z90yzrGqmSyfj3u0001ff04@hotmail.com>
next in thread | raw e-mail | index | archive | help
------=_NextPart_001_0002_01C24228.A5C40FD0 Content-Type: multipart/alternative; boundary="----=_NextPart_002_0003_01C24228.A5C680D0" ------=_NextPart_002_0003_01C24228.A5C680D0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Dear Terry, >See /usr/src/sys/kernel.h. It is done using linker sets and >SYSINIT. Hmm=A1=AD. Thank you! I find the mi_startup() function in /sys/kern/init_main.c, there are some= code as follow: for (sipp =3D sysinit; sipp < sysinit_end; sipp++) { if ((*sipp)->subsystem =3D=3D SI_SUB_DUMMY) continue; /* skip dummy task(s)*/ if ((*sipp)->subsystem =3D=3D SI_SUB_DONE) continue; /* Call function */ (*((*sipp)->func))((*sipp)->udata); /* Check off the one we're just done */ (*sipp)->subsystem =3D SI_SUB_DONE; /* Check if we've installed more sysinit items via KLD */ if (newsysinit !=3D NULL) { if (sysinit !=3D SET_BEGIN(sysinit_set)) free(sysinit, M_TEMP); sysinit =3D newsysinit; sysinit_end =3D newsysinit_end; newsysinit =3D NULL; newsysinit_end =3D NULL; goto restart; } } Now, I am puzzled about the function pointer(func), which is how to work.= =20 For example, I have a NIC =A1=AEfxp0=A1=AF, so the function pointer shoul= d point to the fxp_attach? If that is right, I want to know how the kernel call the mi_startup()? Best Regards Ouyang KaiGet more from the Web. FREE MSN Explorer download : http://ex= plorer.msn.com ------=_NextPart_002_0003_01C24228.A5C680D0 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable <HTML><BODY STYLE=3D"font:10pt verdana; border:none;"><DIV>Dear Terry,</D= IV> <DIV> >See /usr/src/sys/kernel.h. It is done using link= er sets and<BR>>SYSINIT.<BR>Hmm=A1=AD. Thank you!<BR>I find the mi_sta= rtup() function in /sys/kern/init_main.c, there are some code as follow:<= BR>for (sipp =3D sysinit; sipp < sysinit_end; sipp++) {<BR>  = ;if ((*sipp)->subsystem =3D=3D SI_SUB_DUMMY)<BR> cont= inue; /* skip dummy task(s)*/<BR> if ((*sipp)->subsyst= em =3D=3D SI_SUB_DONE)<BR> continue;<BR> /* C= all function */<BR> (*((*sipp)->func))((*sipp)->udata);<= BR> /* Check off the one we're just done */<BR> (*s= ipp)->subsystem =3D SI_SUB_DONE;<BR> /* Check if we've inst= alled more sysinit items via KLD */<BR> if (newsysinit !=3D NU= LL) {<BR> if (sysinit !=3D SET_BEGIN(sysinit_set))<BR>&n= bsp; free(sysinit, M_TEMP);<BR> sysinit= =3D newsysinit;<BR> sysinit_end =3D newsysinit_end;<BR>= newsysinit =3D NULL;<BR> newsysinit_en= d =3D NULL;<BR> goto restart;<BR> }<BR> = }<BR>Now, I am puzzled about the function pointer(func), which is how to = work. <BR>For example, I have a NIC =A1=AEfxp0=A1=AF, so the function poi= nter should point to the fxp_attach?<BR>If that is right, I want to know = how the kernel call the mi_startup()?</DIV> <DIV> </DIV> <DIV>Best R= egards</DIV> <DIV> Ouyang Kai</DIV> <DIV> </DIV> <DIV> </D= IV></BODY></HTML><br clear=3Dall><hr>Get more from the Web. FREE MSN Exp= lorer download : <a href=3D'http://explorer.msn.com'>http://explorer.msn.= com</a><br></p> ------=_NextPart_002_0003_01C24228.A5C680D0-- ------=_NextPart_001_0002_01C24228.A5C40FD0 Content-Type: text/plain; name="kernel_init_problem.txt" Content-Disposition: attachment; filename="kernel_init_problem.txt" Content-Transfer-Encoding: quoted-printable Dear Terry >See /usr/src/sys/kernel.h. It is done using linker sets and >SYSINIT. Hmm=A1=AD. Thank you! I find the mi_startup() function in /sys/kern/init_main.c, there are some= code as follow: for (sipp =3D sysinit; sipp < sysinit_end; sipp++) { if ((*sipp)->subsystem =3D=3D SI_SUB_DUMMY) continue; /* skip dummy task(s)*/ if ((*sipp)->subsystem =3D=3D SI_SUB_DONE) continue; /* Call function */ (*((*sipp)->func))((*sipp)->udata); /* Check off the one we're just done */ (*sipp)->subsystem =3D SI_SUB_DONE; /* Check if we've installed more sysinit items via KLD */ if (newsysinit !=3D NULL) { if (sysinit !=3D SET_BEGIN(sysinit_set)) free(sysinit, M_TEMP); sysinit =3D newsysinit; sysinit_end =3D newsysinit_end; newsysinit =3D NULL; newsysinit_end =3D NULL; goto restart; } } Now, I am puzzled about the function pointer(func), which is how to work.= =20 For example, I have a NIC =A1=AEfxp0=A1=AF, so the function pointer shoul= d point to the fxp_attach? Best Regards Ouyang Kai If that is right, I want to know how the kernel call the mi_startup()? ------=_NextPart_001_0002_01C24228.A5C40FD0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OE72Z90yzrGqmSyfj3u0001ff04>