x86 weirdness

Erwin Rol mailinglists at erwinrol.com
Mon Jul 30 18:36:26 EDT 2012


Hallo,

after I had successfully "ported" barebox to about 5 different embedded 
x86 (mostly N270 and Z510 Atom boards) I ran into problems with a 
Celeron SU2300 CPU based board. After a lot of trail and error, which 
included the implementation of a BIOS based console cause the board does 
not have a RS232 port, it looked like the global variables were not what 
I expected them to be, namely zero.

So in arch/x86/boot/main_entry.c i changed to following;

/**
  * Called plainly from assembler that switches from real to flat mode
  *
  * @note The C environment isn't initialized yet
  */
void uboot_entry(void)
{
#if 0
         /* clear the BSS first */
         memset(__bss_start, 0x00, __bss_stop - __bss_start);
#else
         unsigned char* ptr;
         for (ptr = __bss_start; ptr < __bss_stop; ptr++)
                 *ptr = 0x00;
#endif


         start_barebox();
}


After doing that it works. I have not yet looked into the resulting asm 
to find the differences, but could someone have an explanation for why 
the memset doesn't work and the simple loop does work?

- Erwin









More information about the barebox mailing list