[PATCH] Implement ALTERNATE memory layout.

Antony Pavlov antonynpavlov at gmail.com
Sat Mar 30 14:45:19 EDT 2013


On 30 March 2013 15:25, Krzysztof Halasa <khc at pm.waw.pl> wrote:

> Signed-off-by: Krzysztof Hałasa <khc at pm.waw.pl>
>
> --- a/arch/arm/cpu/start.c
> +++ b/arch/arm/cpu/start.c
> @@ -58,7 +58,6 @@ static noinline __noreturn void __start(uint32_t
> membase, uint32_t memsize,
>         endmem -= STACK_SIZE; /* Stack */
>
>         if (IS_ENABLED(CONFIG_MMU_EARLY)) {
> -
>                 endmem &= ~0x3fff;
>                 endmem -= SZ_16K; /* ttb */


This is a formatting change not functional change. Please, move it to a
separate patch.


>


> @@ -66,6 +65,9 @@ static noinline __noreturn void __start(uint32_t
> membase, uint32_t memsize,
>                         mmu_early_enable(membase, memsize, endmem);
>         }
>
> +#ifdef CONFIG_MEMORY_LAYOUT_ALTERNATE
> +               malloc_end = endmem;
> +#else
>         if ((unsigned long)_text > membase + memsize ||
>                         (unsigned long)_text < membase)
>                 /*
> @@ -76,15 +78,21 @@ static noinline __noreturn void __start(uint32_t
> membase, uint32_t memsize,
>                 malloc_end = endmem;
>         else
>                 malloc_end = (unsigned long)_text;
> +#endif
>
>         /*
>          * Maximum malloc space is the Kconfig value if given
>          * or 64MB.
>          */
>         if (MALLOC_SIZE > 0) {
> -               malloc_start = malloc_end - MALLOC_SIZE;
> -               if (malloc_start < membase)
> +               if (malloc_end > membase + MALLOC_SIZE)
> +                       malloc_start = malloc_end - MALLOC_SIZE;
> +               else
>                         malloc_start = membase;
> +               if (malloc_start < (unsigned long)_end &&
> +                   malloc_end > (unsigned long)_text)
> +                       /* malloc area follows text */
> +                       malloc_start = (unsigned long)_end;
>         } else {
>                 malloc_start = malloc_end - (malloc_end - membase) / 2;
>                 if (malloc_end - malloc_start > SZ_64M)
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -161,7 +161,7 @@ choice
>  config MEMORY_LAYOUT_DEFAULT
>         bool "use default memory layout"
>         help
> -         select this option to use bareboxs standard memory layout:
> +         select this option to use barebox's standard memory layout:
>
>
This is a "fix typo" change. Please, move it to a separate patch.

          stack
>           -----
> @@ -169,6 +169,17 @@ config MEMORY_LAYOUT_DEFAULT
>           -----
>           TEXT_BASE
>
> +config MEMORY_LAYOUT_ALTERNATE
> +       bool "use alternate memory layout"
> +       help
> +         select this option to use barebox's alternate memory layout:
> +
> +         TEXT_BASE
> +         -----
> +         malloc heap
> +         -----
> +         stack
> +
>  config MEMORY_LAYOUT_FIXED
>         bool "manually assign a memory layout"
>         help
>
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>



-- 
Best regards,
  Antony Pavlov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20130330/d93d9440/attachment.html>


More information about the barebox mailing list