libtests/malloc04
Joel Sherrill
joel.sherrill at OARcorp.com
Fri May 3 14:44:08 UTC 2013
On 5/3/2013 9:32 AM, Sebastian Huber wrote:
> Hello,
>
> the libtests/malloc04 test has this function:
>
> void * sbrk(ptrdiff_t incr)
> {
> void *p = (void *) -1;
>
> printf( "sbrk(%td)\n", incr );
> if ( sbrk_count == -1 ) {
> p = (void *) (NULL - 2);
> } else if ( offset + incr < sizeof(Malloc_Heap) ) {
> p = &Malloc_Heap[ offset ];
> offset += incr;
> } else {
> if ( sbrk_count == 0 )
> p = (void *) rtems_task_create;
> sbrk_count++;
> }
>
> sbrk_count++;
> return p;
> }
>
> What is the purpose of the "p = (void *) rtems_task_create;"? This test fails
> on a BSP with a write protected code space, because malloc() tries to extend
> its space with the area covered by the rtems_test_create() function.
>
If I recall correctly, it was intended to be a valid but non-contiguous
address
and get rejected by the extend.
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the devel
mailing list