Skip site navigation (1)Skip section navigation (2)
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>&nbsp;&gt;See /usr/src/sys/kernel.h.&nbsp; It is done using link=
er sets and<BR>&gt;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 &lt; sysinit_end; sipp++) {<BR>&nbsp;&nbsp=
;if ((*sipp)-&gt;subsystem =3D=3D SI_SUB_DUMMY)<BR>&nbsp;&nbsp;&nbsp;cont=
inue;&nbsp;/* skip dummy task(s)*/<BR>&nbsp;&nbsp;if ((*sipp)-&gt;subsyst=
em =3D=3D SI_SUB_DONE)<BR>&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;/* C=
all function */<BR>&nbsp;&nbsp;(*((*sipp)-&gt;func))((*sipp)-&gt;udata);<=
BR>&nbsp;&nbsp;/* Check off the one we're just done */<BR>&nbsp;&nbsp;(*s=
ipp)-&gt;subsystem =3D SI_SUB_DONE;<BR>&nbsp;&nbsp;/* Check if we've inst=
alled more sysinit items via KLD */<BR>&nbsp;&nbsp;if (newsysinit !=3D NU=
LL) {<BR>&nbsp;&nbsp;&nbsp;if (sysinit !=3D SET_BEGIN(sysinit_set))<BR>&n=
bsp;&nbsp;&nbsp;&nbsp;free(sysinit, M_TEMP);<BR>&nbsp;&nbsp;&nbsp;sysinit=
 =3D newsysinit;<BR>&nbsp;&nbsp;&nbsp;sysinit_end =3D newsysinit_end;<BR>=
&nbsp;&nbsp;&nbsp;newsysinit =3D NULL;<BR>&nbsp;&nbsp;&nbsp;newsysinit_en=
d =3D NULL;<BR>&nbsp;&nbsp;&nbsp;goto restart;<BR>&nbsp;&nbsp;}<BR>&nbsp;=
}<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>&nbsp;</DIV> <DIV>Best R=
egards</DIV> <DIV>&nbsp;Ouyang Kai</DIV> <DIV>&nbsp;</DIV> <DIV>&nbsp;</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>