From: Joe Hershberger Date: Tue, 20 Mar 2012 22:38:48 +0000 (-0500) Subject: Xilinx: ARM: Fix memory corruption bug in pele timer_init X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=91c7d51149da7b4642b08094956b1e54f297818b;p=thirdparty%2Fu-boot.git Xilinx: ARM: Fix memory corruption bug in pele timer_init Global variables (.bss) must not be accessed before relocation. That memory is now overlayed with the .rel.dyn ELF relocation table. Even if that was allowed, it would have no positive effect since initialized value would not be relocated into RAM. It would be 0 again. Signed-off-by: Joe Hershberger --- diff --git a/arch/arm/cpu/armv7/pele/timer.c b/arch/arm/cpu/armv7/pele/timer.c index 1884448a835..237fe4427d0 100644 --- a/arch/arm/cpu/armv7/pele/timer.c +++ b/arch/arm/cpu/armv7/pele/timer.c @@ -89,8 +89,9 @@ int timer_init() /* Enable the decrementer */ val |= XSCUTIMER_CONTROL_ENABLE_MASK; XScuTimer_WriteReg(XSCUTIMER_CONTROL_OFFSET, val); - - reset_timer_masked(); + + /* This must not be called before relocation */ + /*reset_timer_masked();*/ return 0; } @@ -133,7 +134,7 @@ ulong get_tbclk(void) void reset_timer_masked(void) { /* reset time */ - lastdec = XScuTimer_GetCounterValue() / (TIMER_TICK_HZ/CONFIG_SYS_HZ); + lastdec = XScuTimer_GetCounterValue() / (TIMER_TICK_HZ/CONFIG_SYS_HZ); timestamp = 0; }