home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / linux / 21470 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.6 KB  |  47 lines

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