From dea3eccb38b556b04552219e00b7abd656587278 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sun, 6 Sep 2009 15:24:08 +0000 Subject: 2009-09-06 Sebastian Huber * libcsupport/src/free.c, libmisc/stackchk/check.c, rtems/include/rtems/rtems/region.h, rtems/src/regioncreate.c, rtems/src/regionextend.c, rtems/src/regiongetinfo.c, rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, rtems/src/regionresizesegment.c, score/src/pheapallocate.c, score/src/pheapallocatealigned.c, score/src/pheapextend.c, score/src/pheapfree.c, score/src/pheapgetblocksize.c, score/src/pheapgetfreeinfo.c, score/src/pheapgetinfo.c, score/src/pheapgetsize.c, score/src/pheapinit.c, score/src/pheapresizeblock.c, score/src/pheapwalk.c: Update for heap API changes. * score/include/rtems/score/apimutex.h, score/include/rtems/score/object.h: Documentation. * score/include/rtems/score/heap.h, score/include/rtems/score/protectedheap.h, score/inline/rtems/score/heap.inl, score/src/heap.c, score/src/heapallocate.c, score/src/heapallocatealigned.c, score/src/heapextend.c, score/src/heapfree.c, score/src/heapgetfreeinfo.c, score/src/heapgetinfo.c, score/src/heapresizeblock.c, score/src/heapsizeofuserarea.c, score/src/heapwalk.c: Overall cleanup. Added boundary constraint to allocation function. More changes follow. --- cpukit/score/src/heapgetinfo.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'cpukit/score/src/heapgetinfo.c') diff --git a/cpukit/score/src/heapgetinfo.c b/cpukit/score/src/heapgetinfo.c index 7f907170b9..bc3d4cc893 100644 --- a/cpukit/score/src/heapgetinfo.c +++ b/cpukit/score/src/heapgetinfo.c @@ -1,6 +1,12 @@ -/* - * Heap Handler +/** + * @file + * + * @ingroup ScoreHeap * + * @brief Heap Handler implementation. + */ + +/* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * @@ -19,27 +25,13 @@ #include #include -/* - * _Heap_Get_information - * - * This kernel routine walks the heap and tots up the free and allocated - * sizes. Derived from _Heap_Walk. - * - * Input parameters: - * the_heap - pointer to heap header - * the_info - pointer for information to be returned - * - * Output parameters: - * *the_info - contains information about heap - * return 0=success, otherwise heap is corrupt. - */ -Heap_Get_information_status _Heap_Get_information( +void _Heap_Get_information( Heap_Control *the_heap, Heap_Information_block *the_info ) { - Heap_Block *the_block = the_heap->start; - Heap_Block *const end = the_heap->final; + Heap_Block *the_block = the_heap->first_block; + Heap_Block *const end = the_heap->last_block; _HAssert(the_block->prev_size == the_heap->page_size); _HAssert(_Heap_Is_prev_used(the_block)); @@ -52,7 +44,7 @@ Heap_Get_information_status _Heap_Get_information( the_info->Used.largest = 0; while ( the_block != end ) { - uint32_t const the_size = _Heap_Block_size(the_block); + uintptr_t const the_size = _Heap_Block_size(the_block); Heap_Block *const next_block = _Heap_Block_at(the_block, the_size); Heap_Information *info; @@ -74,7 +66,5 @@ Heap_Get_information_status _Heap_Get_information( * "used" as client never allocated it. Make 'Used.total' contain this * blocks' overhead though. */ - the_info->Used.total += HEAP_LAST_BLOCK_OVERHEAD; - - return HEAP_GET_INFORMATION_SUCCESSFUL; + the_info->Used.total += HEAP_BLOCK_HEADER_SIZE; } -- cgit v1.2.3