home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!cayman!mona!pgf
- From: pgf@cayman.com (Paul Fox)
- Newsgroups: comp.os.linux
- Subject: Re: IMPORTANT [BUG in 0.99] Re: [ANNOUNCE]: linux version 0.99
- Message-ID: <12271@cayman.COM>
- Date: 23 Dec 92 00:14:39 GMT
- References: <1992Dec19.222324.22106@klaava.Helsinki.FI>
- Sender: news@cayman.COM
- Lines: 34
- Nntp-Posting-Host: mona
- X-Newsreader: TIN [version 1.1 PL8]
-
- Lars Wirzenius (wirzeniu@klaava.Helsinki.FI) wrote:
- : >Just curious - I haven't got the .99 sources yet, but why is an explicit
- : >initialiser needed here. A static pointer ought to be initialised to
- : >NULL in the executable already?
-
- : In normal C programs, yes, but the kernel is a bit special. Like, for
- : instance, who is going to do the initialization? Normally it is the
- : kernel (which zeroes out all memory before it is given to a user
- : process), the linker (which loads the pre-initialized variables from a
- : file, i.e. those variables which are given an explicit initializer),
- : and possbily the C startup code. Trouble is, none of these are active
- : when the kernel is booting...
-
- Wait a minute -- it's not that special. I realize the following code
- relies on .bss immediately following .data, but if it doesn't, it's easy
- enough to guarantee that some "start_bss" symbol is always first in bss to
- use in place of the linker-defined "edata":
-
- main()
- {
- extern byte edata[];
- extern byte end[];
-
- bzero (edata, end - edata);
- .
- .
- .
- }
-
- Obviously you'd want to keep this pretty early in main(). :-)
-
-
- paul fox, pgf@cayman.com, (617)494-1999
- Cayman Systems, Inc., 26 Landsdowne St., Cambridge, MA 02139
-