Re: Kernel running XIP or from RAM?



Ok cheers, that is helpful. I like the idea of reading the structure from the
flash even though it sounds like more of a pain. If have some more details
about that idea, that would be cool. I have complete (well, ok almost)
control of the kernel which may make things easier.

You mentioned the struct might be in flash even if the kernel has been
downloaded into RAM. Does this imply eboot writes some this struct into flash?

Yes I know NOR flash is slow! We've recently introduced a hard disk onto the
hardware and that has slowed the app too, but that's another story. I like
the idea of making some parts of the kernel XIP and some RAM, but when I get
some more time I'll post that on the appropriate group :-)

"remco" wrote:

> "Gary Metalle" <GaryMetalle@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:D20E52B2-A4E5-4719-99DF-9DF61F9FA740@xxxxxxxxxxxxxxxx
> > Is there a way for an application to determine if the kernel is running
> XIP
> > or RAM?
> > I would like to print some memory stats showing how the physical chip
> memory
> > is being used.
> > GetStoreInformation() is good for working out the amount of memory used
> for
> > the object store.
> > GlobalMemoryStatus() is good for working out the amount of memory used for
> > the system heap.
> > If the kernel is running XIP then this information is enough to get within
> > about 90% of the physical device RAM (the remaining must be things like
> > display frame store and other bits-and-bobs?).
> > If the image is running from RAM then there will be a loss of about 12MB
> or
> > so because eboot has loaded the kernel into RAM, but it would be nice to
> know
> > this and then make some crude estimates (looking at the \Windows folder)
> as
> > to size of the RAM-resident kernel.
> >
> > I only want to do this for debug, but it is a good exercise to learn how
> the
> > memory management works for CE
>
>
> Never thought about this until now, because the kernel's image has always
> been under my control so never had to worry about it -- but it is an
> interesting question..
>
> There is a structure within the NK.bin that determines first and last
> location exe and regular ram location. I suspect that your platform has it
> stored in flash somewhere so there's a way to find it but that might be a
> little tricky. Let me know if you need to do that.
>
> An easier way may be to do this:
> It is a little hackish, but you could get a pointer to any benign not
> normally called API function and see where it is located.
> If you don't know where ram is located on your platform, test whether that
> pointer is RAM or flash by reading (you'll have to do a
> virtualAlloc/VirtualCopy first to get to it) out what's under the pointer
> and store it in a temp, scribble something to that location, see if it
> changed successfully, if so - you're running from ram else rom. If ram,
> scribble your temp back and the image is good as new.
>
> Just remember that XIP tends to be a lot slower in flash than when it is
> running out of DRAM because of increased wait states.
>
> Hope that helps.
> Remco
>
>
>
.



Relevant Pages

  • [PATCH 2.6.24] mm: BadRAM support for broken memory
    ... This is the latest version of the BadRAM patch, ... run Linux on broken memory. ... a new kernel appeared, ... the BadRAM subsystem dealing with statically challanged RAM modules. ...
    (Linux-Kernel)
  • Re: Memory configuration of WinCE Image
    ... Actually I am not sure how to configure my PB to dowload image in RAM? ... As the error is pointing of lack of memory, I have configured memory in my ... Board registers. ... for the new boot flash address: ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Patch 4/6 randomize the stack pointer
    ... > it," so perhaps this would be a good compromise. ... less than 512M of memory to keep track of. ... what about the case where you have gobs of RAM and need a highmem ... Kernel data structures, no. ...
    (Linux-Kernel)
  • Re: Allocating kernel memory
    ... > I never complained about the real memory that was used but pointed out ... > that a large portion of the kernel virtual address space is used up. ... RAM you should avoid PAE, ... But it was limited to 1GB of physical RAM. ...
    (comp.os.linux.development.system)
  • Re: Newbie Setting up xserver
    ... Could be, but now that I know that low memory is causing the problem, I will ... The kernel gobbles up the rest of the physical memory huh. ... Actually my RAM is split into two ... >it could be that some of the processes related to setting the timezone ...
    (comp.os.linux.setup)

Loading