i386: Fix malloc initialization

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
This commit is contained in:
Graeme Russ 2009-11-24 20:04:13 +11:00 committed by Wolfgang Denk
parent c74bfce0fb
commit b4feeb4e8a
5 changed files with 10 additions and 17 deletions

View file

@ -1522,11 +1522,6 @@ void *sbrk(ptrdiff_t increment)
return (void *)old; return (void *)old;
} }
#ifndef CONFIG_X86
/*
* x86 boards use a slightly different init sequence thus they implement
* their own version of mem_malloc_init()
*/
void mem_malloc_init(ulong start, ulong size) void mem_malloc_init(ulong start, ulong size)
{ {
mem_malloc_start = start; mem_malloc_start = start;
@ -1535,7 +1530,6 @@ void mem_malloc_init(ulong start, ulong size)
memset((void *)mem_malloc_start, 0, size); memset((void *)mem_malloc_start, 0, size);
} }
#endif
/* field-extraction macros */ /* field-extraction macros */

View file

@ -61,7 +61,7 @@
/* /*
* Size of malloc() pool * Size of malloc() pool
*/ */
#define CONFIG_MALLOC_SIZE (CONFIG_SYS_ENV_SIZE + 128*1024) #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024)
#define CONFIG_BAUDRATE 9600 #define CONFIG_BAUDRATE 9600

View file

@ -65,7 +65,7 @@
/* /*
* Size of malloc() pool * Size of malloc() pool
*/ */
#define CONFIG_MALLOC_SIZE (CONFIG_ENV_SIZE + 128*1024) #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024)
#define CONFIG_BAUDRATE 9600 #define CONFIG_BAUDRATE 9600

View file

@ -63,7 +63,7 @@
/* /*
* Size of malloc() pool * Size of malloc() pool
*/ */
#define CONFIG_MALLOC_SIZE (CONFIG_ENV_SIZE + 128*1024) #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024)
#define CONFIG_BAUDRATE 9600 #define CONFIG_BAUDRATE 9600

View file

@ -77,17 +77,16 @@ ulong i386boot_bios_size = (ulong)&_i386boot_bios_size; /* size of BIOS
const char version_string[] = const char version_string[] =
U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"; U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")";
static int mem_malloc_init(void) static int heap_init(void)
{ {
/* start malloc area right after the stack */ /* start malloc area right after the stack */
mem_malloc_start = i386boot_bss_start + ulong start = i386boot_bss_start + i386boot_bss_size +
i386boot_bss_size + CONFIG_SYS_STACK_SIZE; CONFIG_SYS_STACK_SIZE;
mem_malloc_start = (mem_malloc_start+3)&~3;
/* Use all available RAM for malloc() */ /* 4-byte aligned */
mem_malloc_end = gd->ram_size; start = (start+3)&~3;
mem_malloc_brk = mem_malloc_start; mem_malloc_init(start, CONFIG_SYS_MALLOC_LEN);
return 0; return 0;
} }
@ -184,7 +183,7 @@ init_fnc_t *init_sequence[] = {
cpu_init, /* basic cpu dependent setup */ cpu_init, /* basic cpu dependent setup */
board_init, /* basic board dependent setup */ board_init, /* basic board dependent setup */
dram_init, /* configure available RAM banks */ dram_init, /* configure available RAM banks */
mem_malloc_init, /* dependant on dram_init */ heap_init, /* dependant on dram_init */
interrupt_init, /* set up exceptions */ interrupt_init, /* set up exceptions */
timer_init, timer_init,
serial_init, serial_init,