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

[-- Attachment #1 --]


[-- Attachment #2 --]
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()?

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OE72Z90yzrGqmSyfj3u0001ff04>