ARM: stack region-related issue
Hi, all!
We have common request_sdram_region("stack", ...) in mem_malloc_resource() (common/memory.c).
But we also have ARM-special request_sdram_region("stack", ...) inside arm_request_stack() initcall.
In normal situation there is no problem at all.
Here is the 'iomem' log for versatile qemu virtual board:
0x00000000 - 0x03ffffff (size 0x04000000) ram0 0x00c00000 - 0x00ffffff (size 0x00400000) malloc space 0x01000000 - 0x0102d5f3 (size 0x0002d5f4) barebox 0x0102d5f4 - 0x0102f307 (size 0x00001d14) barebox data 0x0102f308 - 0x010346db (size 0x000053d4) bss 0x03ff8000 - 0x03ffffff (size 0x00008000) stack
But if the board use MEMORY_LAYOUT_FIXED then we can have a problem.
I enabled CONFIGURABLE_MEMORY_LAYOUT for versatile. Here is a patch:
arch/arm/Kconfig +1 -0
@@ -134,6 +134,7 @@ config ARCH_VERSATILE bool "ARM Versatile boards (ARM926EJ-S)" select CPU_ARM926T select GPIOLIB + select HAVE_CONFIGURABLE_MEMORY_LAYOUT config ARCH_VEXPRESS bool "ARM Vexpres boards"
I have rebuilt barebox with this memory layout:
CONFIG_HAVE_CONFIGURABLE_MEMORY_LAYOUT=y
# CONFIG_MEMORY_LAYOUT_DEFAULT is not setCONFIG_MEMORY_LAYOUT_FIXED=yCONFIG_STACK_BASE=0x20000CONFIG_STACK_SIZE=0x8000CONFIG_MALLOC_BASE=0x00c00000CONFIG_MALLOC_SIZE=0x400000
Here is the 'iomem' log for MEMORY_LAYOUT_FIXED:
0x00000000 - 0x03ffffff (size 0x04000000) ram0 0x00020000 - 0x00027fff (size 0x00008000) stack 0x00c00000 - 0x00ffffff (size 0x00400000) malloc space 0x01000000 - 0x0102d61b (size 0x0002d61c) barebox 0x0102d61c - 0x0102f327 (size 0x00001d0c) barebox data 0x0102f328 - 0x010346fb (size 0x000053d4) bss 0x03ff8000 - 0x03ffffff (size 0x00008000) stack
The result is confusing!
We got two stack regions:
* the first region registered by common code (CONFIG_STACK_BASE=0x20000);
* the second region registered by ARM-specific code.
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 58 lines · On Tue, Jul 16, 2013 at 12:30:12PM +0400, [email protected] wrote:
Hi, all!
We have common
request_sdram_region("stack", ...)inmem_malloc_resource()(common/memory.c).But we also have ARM-special
request_sdram_region("stack", ...)insidearm_request_stack()initcall.In normal situation there is no problem at all.
Here is the 'iomem' log for versatile qemu virtual board:
0x00000000-0x03ffffff(size0x04000000) ram00x00c00000-0x00ffffff(size0x00400000) malloc space0x01000000-0x0102d5f3(size0x0002d5f4) barebox0x0102d5f4-0x0102f307(size0x00001d14) barebox data0x0102f308-0x010346db(size0x000053d4) bss0x03ff8000-0x03ffffff(size0x00008000) stackBut if the board use
MEMORY_LAYOUT_FIXEDthen we can have a problem.I enabled
CONFIGURABLE_MEMORY_LAYOUTfor versatile. Here is a patch:arch/arm/Kconfig +1
-0@@ -134,6 +134,7 @@ config ARCH_VERSATILE bool "ARM Versatile boards (ARM926EJ-S)" select CPU_ARM926T select GPIOLIB + select HAVE_CONFIGURABLE_MEMORY_LAYOUT config ARCH_VEXPRESS bool "ARM Vexpres boards"I have rebuilt barebox with this memory layout:
CONFIG_HAVE_CONFIGURABLE_MEMORY_LAYOUT=y
#CONFIG_MEMORY_LAYOUT_DEFAULTis not setCONFIG_MEMORY_LAYOUT_FIXED=yCONFIG_STACK_BASE=0x20000CONFIG_STACK_SIZE=0x8000CONFIG_MALLOC_BASE=0x00c00000CONFIG_MALLOC_SIZE=0x400000Here is the 'iomem' log for
MEMORY_LAYOUT_FIXED:
0x00000000-0x03ffffff(size0x04000000) ram00x00020000-0x00027fff(size0x00008000) stack0x00c00000-0x00ffffff(size0x00400000) malloc space0x01000000-0x0102d61b(size0x0002d61c) barebox0x0102d61c-0x0102f327(size0x00001d0c) barebox data0x0102f328-0x010346fb(size0x000053d4) bss0x03ff8000-0x03ffffff(size0x00008000) stack
Quoted 4 lines
The result is confusing!
We got two stack regions:
* the first region registered by common code (CONFIG_STACK_BASE=0x20000);
* the second region registered by ARM-specific code.
We should probably get rid of CONFIG_MEMORY_LAYOUT_FIXED completely. Currently this is used only by some omap xloader configurations, but this could be changed.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox