libtests/malloc04

Sebastian Huber sebastian.huber at embedded-brains.de
Fri May 3 14:32:04 UTC 2013


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.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list