Code-paths responsible for initializing CPU's stack pointer and variable used in stack memory resource reservation got out of sync which resulted in actual stack being 64K off from what "stack" struct resource registered by arm_request_stack() thought it was. At least one issue resulting from that can be easily triggered by running: memtest -t This commit unifies the aforementioned code to a certain degree which solves the problem and hopefuly makes it less likely to become an issue again. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
#include <types.h>
|
|
|
|
#include <asm/cache.h>
|
|
#include <asm/barebox-arm.h>
|
|
|
|
#include "entry.h"
|
|
|
|
/*
|
|
* Main ARM entry point. Call this with the memory region you can
|
|
* spare for barebox. This doesn't necessarily have to be the full
|
|
* SDRAM. The currently running binary can be inside or outside of
|
|
* this region. TEXT_BASE can be inside or outside of this
|
|
* region. boarddata will be preserved and can be accessed later with
|
|
* barebox_arm_boarddata().
|
|
*
|
|
* -> membase + memsize
|
|
* STACK_SIZE - stack
|
|
* 16KiB, aligned to 16KiB - First level page table if early MMU support
|
|
* is enabled
|
|
* 128KiB - early memory space
|
|
* -> maximum end of barebox binary
|
|
*
|
|
* Usually a TEXT_BASE of 1MiB below your lowest possible end of memory should
|
|
* be fine.
|
|
*/
|
|
|
|
void __naked __noreturn barebox_arm_entry(unsigned long membase,
|
|
unsigned long memsize, void *boarddata)
|
|
{
|
|
arm_setup_stack(arm_mem_stack_top(membase, membase + memsize) - 16);
|
|
arm_early_mmu_cache_invalidate();
|
|
|
|
if (IS_ENABLED(CONFIG_PBL_MULTI_IMAGES))
|
|
barebox_multi_pbl_start(membase, memsize, boarddata);
|
|
else if (IS_ENABLED(CONFIG_PBL_SINGLE_IMAGE))
|
|
barebox_single_pbl_start(membase, memsize, boarddata);
|
|
else
|
|
barebox_non_pbl_start(membase, memsize, boarddata);
|
|
}
|