9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: jmk@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Data segment vs BSS
Date: Tue, 31 Jan 2006 00:48:03 -0500	[thread overview]
Message-ID: <5e571fa65ee3c57240eec513554d9eba@plan9.bell-labs.com> (raw)
In-Reply-To: <56a297000601302135j778614c3r1ba9751ffa557cff@mail.gmail.com>

The part of the loader for this is not dificult to understand.
Grep for HEADTYPE in the source, only asm.c and obj.c will likely
come up, and in each only one function: obj.c:main() sets up the
variables that say where the virtual addresses of the sections are
and asm.c:asmb() seeks around using those values for the different
header types and writes the stuff out.

Usually the data section has 2 types of data in it, constant data
and data that can be modiied by the programme, how are you planning
to separate those out?

Many years ago when I did the boot ROM for the Hobbit boards I just
copied the data to real memory so there was no issue like this. How
big is your data segment, big enough to worry about using up RAM?

On Tue Jan 31 00:36:11 EST 2006, noah.evans@gmail.com wrote:
> Hmmmmm... it will require a lot of work understanding the linker, but
> if I end up running out of memory, I might see if I can get the const
> keyword to throw  those variables in the text section and avoid the
> problem altogether.
> 
> What do you think?
> 
> Noah
> 
> 
> 
> On 1/31/06, jmk@plan9.bell-labs.com <jmk@plan9.bell-labs.com> wrote:
> > The normal Plan 9 binary format assumes the BSS starts immediately
> > after the data, there is no place in the header to specify otherwise.
> > So, you want to use a different header format, e.g. ELF or one of
> > the machine-specific boot formats, see /sys/src/cmd/?l/asm.c for
> > examples. There may be one there already that suits, or you can easily
> > add another for your particular environment.
> >
> > But how do you separate out the constant data?
> >
> > On Mon Jan 30 23:36:55 EST 2006, noah.evans@gmail.com wrote:
> > > Hey, quick 2l question. Is there any way to keep constant values in
> > > ROM? If possible I'd like to keep the data section entirely in ROM
> > > and only keep the BSS section in RAM. However, both sections seem to
> > > be inextricably linked.
> > >
> > > What's the proper way to deal with this?
> > >
> > > Noah
> >


  reply	other threads:[~2006-01-31  5:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-31  4:36 Noah Evans
2006-01-31  5:09 ` jmk
2006-01-31  5:35   ` Noah Evans
2006-01-31  5:48     ` jmk [this message]
2006-01-31  5:54       ` Ronald G Minnich
2006-01-31  8:48         ` Noah Evans
2006-01-31 15:03           ` Ronald G Minnich
2006-01-31 15:12             ` Noah Evans
2006-01-31 16:05               ` Ronald G Minnich
2006-01-31 16:11                 ` Noah Evans
2006-01-31 16:24                 ` Russ Cox
2006-01-31 16:30                   ` Paul Lalonde
2006-01-31 16:52                   ` C H Forsyth
2006-01-31 17:33                   ` Ronald G Minnich
2006-01-31 11:44         ` C H Forsyth
2006-01-31 12:06           ` Charles Forsyth
2006-01-31 12:39           ` Charles Forsyth
2006-01-31 13:06             ` Noah Evans
2006-01-31 13:44               ` Charles Forsyth
2006-01-31 12:39         ` Charles Forsyth
2006-01-31 15:05           ` Ronald G Minnich
2006-01-31  9:03       ` Noah Evans

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=5e571fa65ee3c57240eec513554d9eba@plan9.bell-labs.com \
    --to=jmk@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /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;
as well as URLs for NNTP newsgroup(s).