RES: i386 | pc386 | startup | bspgetworkarea.c | incorrect value of work_area_size

Wendell Pereira da Silva wendell.silva at compsisnet.com.br
Wed Oct 24 22:24:46 UTC 2012


Thanks, Gedare.

Should we file a bug report at bugzilla?
First of all, should this be considered a bug?

--Wendell.

________________________________________
De: gedare at gwmail.gwu.edu [gedare at gwmail.gwu.edu] em Nome de Gedare Bloom [gedare at rtems.org]
Enviado: quarta-feira, 24 de outubro de 2012 18:57
Para: Wendell Pereira da Silva
Cc: rtems-users at rtems.org
Assunto: Re: i386 | pc386 | startup | bspgetworkarea.c | incorrect value of work_area_size

The linker should catch when the bss segment overflows...

But to resolve this I think you can add a condition to compare the two
values, e.g.
if (  bsp_mem_size < rtemsWorkAreaStart )
  *work_area_size = 0;
else
  *work_area_size = bsp_mem_size - rtemsWorkAreaStart;

-Gedare

On Wed, Oct 24, 2012 at 2:44 PM, Wendell Pereira da Silva
<wendell.silva at compsisnet.com.br> wrote:
> Hi,
>
> Before filing a bug report, I would like to share some thoughts about the
> following code of bspgetworkarea.c:
>
>
> void
>
> bsp_get_work_area(
>
>    void **work_area_start,
>
>    uintptr_t *work_area_size,
>
>    void **heap_start,
>
>    uintptr_t *heap_size
>
> )
>
> {
>
> (... removed for simplicity)
>
>    *work_area_size = (uintptr_t) bsp_mem_size - (uintptr_t)
> rtemsWorkAreaStart;
>
> (... removed for simplicity)
>
>
>
> I've done an experiment by forcing my app to statically allocate a huge
> memory area producing a bss larger than the physical memory available on my
> board. I expected a message like "not enough memory for RTEMS workspace".
> But, this caused the rtemsWorkAreaStart be greater than bsp_mem_size,
> producing a work_area_size a very large value since it they are unsigned.
> The program, then, entered a very long loop while dirtying the memory
> (because I defined BSP_DIRT_MEMORY) back on bootcard.c.
>
> My questions are:
>  - Where is the good place the check if bsp_mem_size got less than
> rtemsWorkAreaStart?
>
> My sugestion:
>  - force work_are_size = 0, when bsp_mem_size is less than
> rtemsWorkAreaStart inside bsp_get_work_area().
>
> More info:
> Code verified: RTEMS 4.11 (4.10.99), RTEMS 4.10.2
>
> Best regards for all.
>
> --Wendell.
>
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
>



More information about the users mailing list