From: David Eger <eger@havoc.gtf.org>
To: krishna <krishna.c@globaledgesoft.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: How to understand flow of kernel code
Date: Mon, 27 Dec 2004 15:22:58 -0500 [thread overview]
Message-ID: <20041227202258.GA530@havoc.gtf.org> (raw)
In-Reply-To: <41AE9E3E.9020307@globaledgesoft.com>
One of the more bizarre details of kernel initialization is in
do_initcalls(). It's one of the last things in the initialization
sequence that you see code for, and it does some odd function-pointer
table assembly hackery. You don't actually see a list of the functions
that do_initcalls() calls because *it's generated at compile time*.
Each module/filesystem/arch/etc can register an initialization function
with the build system through a declaration like the following in
"binfmt_elf.c":
core_initcall(init_elf_binfmt);
This macro is defined in init.h, along with several others:
#define core_initcall(fn) __define_initcall("1",fn)
#define postcore_initcall(fn) __define_initcall("2",fn)
#define arch_initcall(fn) __define_initcall("3",fn)
#define subsys_initcall(fn) __define_initcall("4",fn)
#define fs_initcall(fn) __define_initcall("5",fn)
#define device_initcall(fn) __define_initcall("6",fn)
#define late_initcall(fn) __define_initcall("7",fn)
When the build system is done building all the files, it gathers together
all of the special initcall declarations and links them into one table:
the one that do_initcalls() iterates over.
-dte
next prev parent reply other threads:[~2004-12-27 20:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-02 4:46 krishna
2004-12-02 6:21 ` Bernd Eckenfels
2004-12-02 16:11 ` Jeff V. Merkey
2004-12-04 12:55 ` [OT] " Andries Brouwer
2004-12-04 16:39 ` Manu Abraham
2004-12-04 14:51 ` Jon Masters
2004-12-27 20:22 ` David Eger [this message]
2004-12-02 18:28 Nick Warne
2004-12-02 19:13 ` Randy.Dunlap
2004-12-02 19:48 ` Cal Peake
2004-12-03 15:09 krishna
2004-12-03 15:27 ` Josh Boyer
2004-12-06 14:22 krishna
2004-12-06 18:49 ` Jon Masters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041227202258.GA530@havoc.gtf.org \
--to=eger@havoc.gtf.org \
--cc=krishna.c@globaledgesoft.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®