2010-08-10 Joel Sherrill <joel.sherrill@oarcorp.com>

PR 1661/testing
	* malloc04/init.c: Add public methods to get/set malloc heap pointer so
	the tests do not have to peer behind the API.
This commit is contained in:
Joel Sherrill
2010-08-10 13:15:38 +00:00
parent bad55939df
commit 07b93de9fd
2 changed files with 24 additions and 16 deletions

View File

@@ -1,3 +1,9 @@
2010-08-10 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1661/testing
* malloc04/init.c: Add public methods to get/set malloc heap pointer so
the tests do not have to peer behind the API.
2010-08-09 Bharath Suri <bharath.s.jois@gmail.com>
PR 1661/testing

View File

@@ -15,15 +15,26 @@
#include <rtems/malloc.h>
#include <errno.h>
/* configuration information */
/* At top of file to have access to configuration variables */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of configuration */
char Malloc_Heap[ 128 ] CPU_STRUCTURE_ALIGNMENT;
int sbrk_count;
Heap_Control Heap_Holder;
Heap_Control TempHeap;
/* Heap variables we need to peek and poke at */
extern Heap_Control *RTEMS_Malloc_Heap;
extern size_t RTEMS_Malloc_Sbrk_amount;
extern rtems_malloc_sbrk_functions_t *rtems_malloc_sbrk_helpers;
extern rtems_malloc_sbrk_functions_t rtems_malloc_sbrk_helpers_table;
size_t offset;
@@ -52,6 +63,7 @@ rtems_task Init(
)
{
void *p1, *p2, *p3, *p4;
Heap_Control *TempHeap;
sbrk_count = 0;
offset = 0;
@@ -59,7 +71,8 @@ rtems_task Init(
puts( "\n\n*** TEST MALLOC 04 ***" );
/* Safe information on real heap */
Heap_Holder = *RTEMS_Malloc_Heap;
TempHeap = malloc_get_heap_pointer();
Heap_Holder = *TempHeap;
rtems_malloc_sbrk_helpers = &rtems_malloc_sbrk_helpers_table;
puts( "Initialize heap with some memory" );
@@ -112,7 +125,7 @@ rtems_task Init(
p4 = malloc(48);
/* Restore information on real heap */
*RTEMS_Malloc_Heap = Heap_Holder;
malloc_set_heap_pointer( TempHeap );
rtems_malloc_sbrk_helpers = NULL;
puts( "*** END OF TEST MALLOC 04 ***" );
@@ -120,15 +133,4 @@ rtems_task Init(
rtems_test_exit(0);
}
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */