[U-Boot-Users] Réf. : Re: [U-Boot-Users] get_ram_size bug and ask for comments

Matthieu CASTET matthieu.castet at sagem.com
Mon Mar 27 09:43:07 CEST 2006


Hi Wolfgang,

it seems the code I have was modified.
I look in the original cvs version and it seems that the base address 
isn't restored either.


      [...]
        addr = base;
        save[i] = *addr; <-- save value at base address
        *addr = 0; <--- modify it.

        if ((val = *addr) != 0) {
                <--- error case : restore all values
            [...]
        }

        <-- we forget to restore the value and start to restore value 
@base+1 with save[i-1].

        for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
                addr = base + cnt;      /* pointer arith! */
                val = *addr;
                *addr = save[--i];
                if (val != ~cnt) {
                        size = cnt * sizeof (long);
                        /* Restore the original data before leaving the 
function.
                         */
                        for (cnt <<= 1; cnt < maxsize / sizeof (long); cnt 
<<= 1) {
                                addr  = base + cnt;
                                *addr = save[--i];
                        }
                        return (size);
                }
        }


regards,

Matthieu




More information about the U-Boot mailing list