* [U-Boot] Microblaze stack clobbered in d4e8ada0f6d51e0e3b80790fb9375ac8910f5352 (Consolidate arch-specific mem_malloc_init() implementations)
@ 2009-12-04 23:00 Graeme Smecher
2009-12-07 10:12 ` Michal Simek
0 siblings, 1 reply; 2+ messages in thread
From: Graeme Smecher @ 2009-12-04 23:00 UTC (permalink / raw)
To: u-boot
Hi Michal,
It appears there's a problem with the default memory map in u-boot's
"microblaze-generic" configuration. We have (from
include/configs/microblaze-generic.h):
/* ddr sdram - main memory */
#define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START
#define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE
#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE +
0x1000)
/* global pointer */
#define CONFIG_SYS_GBL_DATA_SIZE 128 /* size of global data */
/* start of global data */
#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_SDRAM_BASE +
CONFIG_SYS_SDRAM_SIZE - CONFIG_SYS_GBL_DATA_SIZE)
/* monitor code */
#define SIZE 0x40000
#define CONFIG_SYS_MONITOR_LEN (SIZE -
CONFIG_SYS_GBL_DATA_SIZE)
#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_GBL_DATA_OFFSET -
CONFIG_SYS_MONITOR_LEN)
#define CONFIG_SYS_MONITOR_END (CONFIG_SYS_MONITOR_BASE +
CONFIG_SYS_MONITOR_LEN)
#define CONFIG_SYS_MALLOC_LEN SIZE
#define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE -
CONFIG_SYS_MALLOC_LEN)
/* stack */
#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_MONITOR_BASE
This builds a memory map like the following:
0x47f80000 - 0x47fbffff: malloc region
0x47fc0000 - 0x47ffff7f: monitor
0x47ffff80 - 0x47ffffff: globals
The initial SP is set to 0x47fc0000. This collides with the malloc
region, and when the malloc region is cleared during mem_malloc_init(),
the stack is wiped out. This includes the return address from
mem_malloc_init(), among other things.
Can you confirm that CONFIG_SYS_INIT_SP_OFFSET should be
CONFIG_SYS_MALLOC_BASE instead of CONFIG_SYS_MONITOR_BASE? That agrees
with your memory diagram at include/configs/microblaze-generic.h:103.
thanks,
Graeme
^ permalink raw reply [flat|nested] 2+ messages in thread* [U-Boot] Microblaze stack clobbered in d4e8ada0f6d51e0e3b80790fb9375ac8910f5352 (Consolidate arch-specific mem_malloc_init() implementations)
2009-12-04 23:00 [U-Boot] Microblaze stack clobbered in d4e8ada0f6d51e0e3b80790fb9375ac8910f5352 (Consolidate arch-specific mem_malloc_init() implementations) Graeme Smecher
@ 2009-12-07 10:12 ` Michal Simek
0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2009-12-07 10:12 UTC (permalink / raw)
To: u-boot
Hi Graeme,
Graeme Smecher wrote:
> Hi Michal,
>
> It appears there's a problem with the default memory map in u-boot's
> "microblaze-generic" configuration. We have (from
> include/configs/microblaze-generic.h):
>
>
> /* ddr sdram - main memory */
> #define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START
> #define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE
> #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
> #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE +
> 0x1000)
>
> /* global pointer */
> #define CONFIG_SYS_GBL_DATA_SIZE 128 /* size of global data */
> /* start of global data */
> #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_SDRAM_BASE +
> CONFIG_SYS_SDRAM_SIZE - CONFIG_SYS_GBL_DATA_SIZE)
>
> /* monitor code */
> #define SIZE 0x40000
> #define CONFIG_SYS_MONITOR_LEN (SIZE -
> CONFIG_SYS_GBL_DATA_SIZE)
> #define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_GBL_DATA_OFFSET -
> CONFIG_SYS_MONITOR_LEN)
> #define CONFIG_SYS_MONITOR_END (CONFIG_SYS_MONITOR_BASE +
> CONFIG_SYS_MONITOR_LEN)
> #define CONFIG_SYS_MALLOC_LEN SIZE
> #define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE -
> CONFIG_SYS_MALLOC_LEN)
>
> /* stack */
> #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_MONITOR_BASE
>
>
> This builds a memory map like the following:
>
> 0x47f80000 - 0x47fbffff: malloc region
> 0x47fc0000 - 0x47ffff7f: monitor
> 0x47ffff80 - 0x47ffffff: globals
>
> The initial SP is set to 0x47fc0000. This collides with the malloc
> region, and when the malloc region is cleared during mem_malloc_init(),
> the stack is wiped out. This includes the return address from
> mem_malloc_init(), among other things.
>
> Can you confirm that CONFIG_SYS_INIT_SP_OFFSET should be
> CONFIG_SYS_MALLOC_BASE instead of CONFIG_SYS_MONITOR_BASE? That agrees
> with your memory diagram at include/configs/microblaze-generic.h:103.
yes, you are correct.
Please create proper patch and I will add it to mainline.
Thanks,
Michal
>
> thanks,
> Graeme
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-07 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-04 23:00 [U-Boot] Microblaze stack clobbered in d4e8ada0f6d51e0e3b80790fb9375ac8910f5352 (Consolidate arch-specific mem_malloc_init() implementations) Graeme Smecher
2009-12-07 10:12 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox