[PATCH] Add warning above get_ram_size

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 14 06:35:03 EST 2013


On Thu, Feb 14, 2013 at 10:40:38AM +0100, Maxime Ripard wrote:
> Hi Sascha,
> 
> Le 13/02/2013 18:16, Sascha Hauer a écrit :
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > ---
> >  common/memsize.c |    3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/common/memsize.c b/common/memsize.c
> > index d149e41..ef6381b 100644
> > --- a/common/memsize.c
> > +++ b/common/memsize.c
> > @@ -33,6 +33,9 @@
> >   * Check memory range for valid RAM. A simple memory test determines
> >   * the actually available RAM size between addresses `base' and
> >   * `base + maxsize'.
> > + *
> > + * This function modifies the RAM. Do not use it if you're running from
> > + * the RAM you are going to detect!
> >   */
> 
> Actually, I don't see how it modifies the RAM, at least permanently. The
> values it erase are backed up, and there's no concurrency at barebox
> level, so we are sure that the value saved will still be the one that
> would need to be backed up at the end of the function, right?

Yes, it restores the values, but how do you make sure the function does
not modify the instructions you are currently executing? You need bad
luck to hit this, but sooner or later this will happen.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list