From 41eb1e40900196835f903485a6f81637e6b2210f Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sun, 14 Dec 2008 22:48:54 +0000 Subject: 2008-12-14 Joel Sherrill * libcsupport/src/realloc.c, rtems/include/rtems/rtems/region.h, rtems/src/regioncreate.c, rtems/src/regionextend.c, rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, rtems/src/regionmp.c, rtems/src/regionresizesegment.c, sapi/include/rtems/config.h, score/include/rtems/score/heap.h, score/include/rtems/score/protectedheap.h, score/src/heap.c, score/src/heapallocate.c, score/src/heapallocatealigned.c, score/src/heapextend.c, score/src/heapresizeblock.c, score/src/heapsizeofuserarea.c, score/src/pheapallocate.c, score/src/pheapallocatealigned.c, score/src/pheapextend.c, score/src/pheapgetblocksize.c, score/src/pheapresizeblock.c: Change sizes of heap/region and allocated objects in heap to intptr_t so they can be larger than a single allocatable object (e.g. size_t). --- cpukit/ChangeLog | 16 ++++++++++++++++ cpukit/libcsupport/src/realloc.c | 4 ++-- cpukit/rtems/include/rtems/rtems/region.h | 16 ++++++++-------- cpukit/rtems/src/regioncreate.c | 2 +- cpukit/rtems/src/regionextend.c | 4 ++-- cpukit/rtems/src/regiongetsegment.c | 2 +- cpukit/rtems/src/regiongetsegmentsize.c | 2 +- cpukit/rtems/src/regionmp.c | 2 +- cpukit/rtems/src/regionresizesegment.c | 8 ++++---- cpukit/sapi/include/rtems/config.h | 2 +- cpukit/score/include/rtems/score/heap.h | 24 ++++++++++++------------ cpukit/score/include/rtems/score/protectedheap.h | 12 ++++++------ cpukit/score/src/heap.c | 2 +- cpukit/score/src/heapallocate.c | 2 +- cpukit/score/src/heapallocatealigned.c | 16 +++++++++------- cpukit/score/src/heapextend.c | 4 ++-- cpukit/score/src/heapresizeblock.c | 6 +++--- cpukit/score/src/heapsizeofuserarea.c | 2 +- cpukit/score/src/pheapallocate.c | 2 +- cpukit/score/src/pheapallocatealigned.c | 2 +- cpukit/score/src/pheapextend.c | 4 ++-- cpukit/score/src/pheapgetblocksize.c | 2 +- cpukit/score/src/pheapresizeblock.c | 6 +++--- 23 files changed, 80 insertions(+), 62 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 49bb8f643d..dcb30fd041 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,19 @@ +2008-12-14 Joel Sherrill + + * libcsupport/src/realloc.c, rtems/include/rtems/rtems/region.h, + rtems/src/regioncreate.c, rtems/src/regionextend.c, + rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, + rtems/src/regionmp.c, rtems/src/regionresizesegment.c, + sapi/include/rtems/config.h, score/include/rtems/score/heap.h, + score/include/rtems/score/protectedheap.h, score/src/heap.c, + score/src/heapallocate.c, score/src/heapallocatealigned.c, + score/src/heapextend.c, score/src/heapresizeblock.c, + score/src/heapsizeofuserarea.c, score/src/pheapallocate.c, + score/src/pheapallocatealigned.c, score/src/pheapextend.c, + score/src/pheapgetblocksize.c, score/src/pheapresizeblock.c: Change + sizes of heap/region and allocated objects in heap to intptr_t so + they can be larger than a single allocatable object (e.g. size_t). + 2008-12-14 Joel Sherrill * itron/src/chg_pri.c, itron/src/cre_tsk.c, itron/src/rot_rdq.c, diff --git a/cpukit/libcsupport/src/realloc.c b/cpukit/libcsupport/src/realloc.c index cff5725f3c..5a38ac5c91 100644 --- a/cpukit/libcsupport/src/realloc.c +++ b/cpukit/libcsupport/src/realloc.c @@ -25,9 +25,9 @@ void *realloc( size_t size ) { - ssize_t old_size; + intptr_t old_size; char *new_area; - ssize_t resize; + intptr_t resize; MSBUMP(realloc_calls, 1); diff --git a/cpukit/rtems/include/rtems/rtems/region.h b/cpukit/rtems/include/rtems/rtems/region.h index 74d66ea334..085b317a2c 100644 --- a/cpukit/rtems/include/rtems/rtems/region.h +++ b/cpukit/rtems/include/rtems/rtems/region.h @@ -69,9 +69,9 @@ typedef struct { Objects_Control Object; Thread_queue_Control Wait_queue; /* waiting threads */ void *starting_address; /* physical start addr */ - uint32_t length; /* physical length(bytes) */ + intptr_t length; /* physical length(bytes) */ uint32_t page_size; /* in bytes */ - uint32_t maximum_segment_size; /* in bytes */ + intptr_t maximum_segment_size; /* in bytes */ rtems_attribute attribute_set; uint32_t number_of_used_blocks; /* blocks allocated */ Heap_Control Memory; @@ -106,7 +106,7 @@ void _Region_Manager_initialization( rtems_status_code rtems_region_create( rtems_name name, void *starting_address, - uint32_t length, + intptr_t length, uint32_t page_size, rtems_attribute attribute_set, Objects_Id *id @@ -123,7 +123,7 @@ rtems_status_code rtems_region_create( rtems_status_code rtems_region_extend( Objects_Id id, void *starting_address, - uint32_t length + intptr_t length ); /** @@ -186,7 +186,7 @@ rtems_status_code rtems_region_delete( */ rtems_status_code rtems_region_get_segment( Objects_Id id, - uint32_t size, + intptr_t size, rtems_option option_set, rtems_interval timeout, void **segment @@ -201,7 +201,7 @@ rtems_status_code rtems_region_get_segment( rtems_status_code rtems_region_get_segment_size( Objects_Id id, void *segment, - size_t *size + intptr_t *size ); /** @@ -243,8 +243,8 @@ rtems_status_code rtems_region_return_segment( rtems_status_code rtems_region_resize_segment( Objects_Id id, void *segment, - size_t size, - size_t *old_size + intptr_t size, + intptr_t *old_size ); #ifndef __RTEMS_APPLICATION__ diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index ec305b71a3..98c29bb94a 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -50,7 +50,7 @@ rtems_status_code rtems_region_create( rtems_name name, void *starting_address, - uint32_t length, + intptr_t length, uint32_t page_size, rtems_attribute attribute_set, Objects_Id *id diff --git a/cpukit/rtems/src/regionextend.c b/cpukit/rtems/src/regionextend.c index d8ad00b55c..7f29109e61 100644 --- a/cpukit/rtems/src/regionextend.c +++ b/cpukit/rtems/src/regionextend.c @@ -46,10 +46,10 @@ rtems_status_code rtems_region_extend( Objects_Id id, void *starting_address, - uint32_t length + intptr_t length ) { - uint32_t amount_extended; + intptr_t amount_extended; Heap_Extend_status heap_status; Objects_Locations location; rtems_status_code return_status = RTEMS_INTERNAL_ERROR; diff --git a/cpukit/rtems/src/regiongetsegment.c b/cpukit/rtems/src/regiongetsegment.c index c8b7d46233..e060a8a4e9 100644 --- a/cpukit/rtems/src/regiongetsegment.c +++ b/cpukit/rtems/src/regiongetsegment.c @@ -47,7 +47,7 @@ rtems_status_code rtems_region_get_segment( Objects_Id id, - uint32_t size, + intptr_t size, rtems_option option_set, rtems_interval timeout, void **segment diff --git a/cpukit/rtems/src/regiongetsegmentsize.c b/cpukit/rtems/src/regiongetsegmentsize.c index 7d70b6188b..fd5f3c50e6 100644 --- a/cpukit/rtems/src/regiongetsegmentsize.c +++ b/cpukit/rtems/src/regiongetsegmentsize.c @@ -45,7 +45,7 @@ rtems_status_code rtems_region_get_segment_size( Objects_Id id, void *segment, - size_t *size + intptr_t *size ) { Objects_Locations location; diff --git a/cpukit/rtems/src/regionmp.c b/cpukit/rtems/src/regionmp.c index 48148cc726..94d0104ae9 100644 --- a/cpukit/rtems/src/regionmp.c +++ b/cpukit/rtems/src/regionmp.c @@ -83,7 +83,7 @@ rtems_status_code _Region_MP_Send_request_packet ( Region_MP_Remote_operations operation, Objects_Id region_id, void *segment, - uint32_t size, + intptr_t size, rtems_option option_set, rtems_interval timeout ) diff --git a/cpukit/rtems/src/regionresizesegment.c b/cpukit/rtems/src/regionresizesegment.c index 43cb302afd..2bbca2bae5 100644 --- a/cpukit/rtems/src/regionresizesegment.c +++ b/cpukit/rtems/src/regionresizesegment.c @@ -46,13 +46,13 @@ rtems_status_code rtems_region_resize_segment( Objects_Id id, void *segment, - size_t size, - size_t *old_size + intptr_t size, + intptr_t *old_size ) { - uint32_t avail_size; + intptr_t avail_size; Objects_Locations location; - uint32_t osize; + intptr_t osize; rtems_status_code return_status = RTEMS_INTERNAL_ERROR; Heap_Resize_status status; register Region_Control *the_region; diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h index c3fe7a2edb..d0af0172d9 100644 --- a/cpukit/sapi/include/rtems/config.h +++ b/cpukit/sapi/include/rtems/config.h @@ -115,7 +115,7 @@ typedef struct { /** This field specifies the size in bytes of the RTEMS Workspace. */ - uint32_t work_space_size; + intptr_t work_space_size; /** This field specifies the maximum number of dynamically installed * used extensions. diff --git a/cpukit/score/include/rtems/score/heap.h b/cpukit/score/include/rtems/score/heap.h index 0587852d78..286205dffc 100644 --- a/cpukit/score/include/rtems/score/heap.h +++ b/cpukit/score/include/rtems/score/heap.h @@ -145,11 +145,11 @@ typedef struct { /** instance number of this heap */ uint32_t instance; /** the size of the memory for heap */ - uint32_t size; + intptr_t size; /** current free size */ - uint32_t free_size; + intptr_t free_size; /** minimum free size ever */ - uint32_t min_free_size; + intptr_t min_free_size; /** current number of free blocks */ uint32_t free_blocks; /** maximum number of free blocks ever */ @@ -262,7 +262,7 @@ typedef struct { uint32_t _Heap_Initialize( Heap_Control *the_heap, void *starting_address, - size_t size, + intptr_t size, uint32_t page_size ); @@ -281,8 +281,8 @@ uint32_t _Heap_Initialize( Heap_Extend_status _Heap_Extend( Heap_Control *the_heap, void *starting_address, - size_t size, - uint32_t *amount_extended + intptr_t size, + intptr_t *amount_extended ); /** @@ -296,7 +296,7 @@ Heap_Extend_status _Heap_Extend( */ void *_Heap_Allocate( Heap_Control *the_heap, - size_t size + intptr_t size ); /** @@ -315,7 +315,7 @@ void *_Heap_Allocate( */ void *_Heap_Allocate_aligned( Heap_Control *the_heap, - size_t size, + intptr_t size, uint32_t alignment ); @@ -336,7 +336,7 @@ void *_Heap_Allocate_aligned( bool _Heap_Size_of_user_area( Heap_Control *the_heap, void *starting_address, - size_t *size + intptr_t *size ); /** @@ -364,9 +364,9 @@ bool _Heap_Size_of_user_area( Heap_Resize_status _Heap_Resize_block( Heap_Control *the_heap, void *starting_address, - size_t size, - uint32_t *old_mem_size, - uint32_t *avail_mem_size + intptr_t size, + intptr_t *old_mem_size, + intptr_t *avail_mem_size ); /** diff --git a/cpukit/score/include/rtems/score/protectedheap.h b/cpukit/score/include/rtems/score/protectedheap.h index 78c2abc3d2..1d71ac9b3f 100644 --- a/cpukit/score/include/rtems/score/protectedheap.h +++ b/cpukit/score/include/rtems/score/protectedheap.h @@ -54,7 +54,7 @@ extern "C" { static inline uint32_t _Protected_heap_Initialize( Heap_Control *the_heap, void *starting_address, - size_t size, + intptr_t size, uint32_t page_size ) { @@ -74,7 +74,7 @@ static inline uint32_t _Protected_heap_Initialize( bool _Protected_heap_Extend( Heap_Control *the_heap, void *starting_address, - size_t size + intptr_t size ); /** @@ -88,7 +88,7 @@ bool _Protected_heap_Extend( */ void *_Protected_heap_Allocate( Heap_Control *the_heap, - size_t size + intptr_t size ); /** @@ -107,7 +107,7 @@ void *_Protected_heap_Allocate( */ void *_Protected_heap_Allocate_aligned( Heap_Control *the_heap, - size_t size, + intptr_t size, uint32_t alignment ); @@ -128,7 +128,7 @@ void *_Protected_heap_Allocate_aligned( bool _Protected_heap_Get_block_size( Heap_Control *the_heap, void *starting_address, - size_t *size + intptr_t *size ); /** @@ -146,7 +146,7 @@ bool _Protected_heap_Get_block_size( bool _Protected_heap_Resize_block( Heap_Control *the_heap, void *starting_address, - size_t size + intptr_t size ); /** diff --git a/cpukit/score/src/heap.c b/cpukit/score/src/heap.c index 042dc6d604..014df39d74 100644 --- a/cpukit/score/src/heap.c +++ b/cpukit/score/src/heap.c @@ -115,7 +115,7 @@ static uint32_t instance = 0; uint32_t _Heap_Initialize( Heap_Control *the_heap, void *starting_address, - size_t size, + intptr_t size, uint32_t page_size ) { diff --git a/cpukit/score/src/heapallocate.c b/cpukit/score/src/heapallocate.c index 418ee758fc..86164d209c 100644 --- a/cpukit/score/src/heapallocate.c +++ b/cpukit/score/src/heapallocate.c @@ -36,7 +36,7 @@ void *_Heap_Allocate( Heap_Control *the_heap, - size_t size + intptr_t size ) { uint32_t the_size; diff --git a/cpukit/score/src/heapallocatealigned.c b/cpukit/score/src/heapallocatealigned.c index 3fda404490..d96cdb7c67 100644 --- a/cpukit/score/src/heapallocatealigned.c +++ b/cpukit/score/src/heapallocatealigned.c @@ -23,11 +23,12 @@ static void check_result( - Heap_Control* the_heap, - Heap_Block* the_block, - _H_uptr_t user_addr, - _H_uptr_t aligned_user_addr, - uint32_t size) + Heap_Control *the_heap, + Heap_Block *the_block, + _H_uptr_t user_addr, + _H_uptr_t aligned_user_addr, + intptr_t size +) { _H_uptr_t const user_area = _H_p2u(_Heap_User_area(the_block)); _H_uptr_t const block_end = _H_p2u(the_block) @@ -73,7 +74,8 @@ static Heap_Block *block_allocate( Heap_Control *the_heap, Heap_Block *the_block, - uint32_t alloc_size) + intptr_t alloc_size +) { Heap_Statistics *const stats = &the_heap->stats; uint32_t const block_size = _Heap_Block_size(the_block); @@ -131,7 +133,7 @@ Heap_Block *block_allocate( void *_Heap_Allocate_aligned( Heap_Control *the_heap, - size_t size, + intptr_t size, uint32_t alignment ) { diff --git a/cpukit/score/src/heapextend.c b/cpukit/score/src/heapextend.c index 73eb91f127..340fc84db2 100644 --- a/cpukit/score/src/heapextend.c +++ b/cpukit/score/src/heapextend.c @@ -38,8 +38,8 @@ Heap_Extend_status _Heap_Extend( Heap_Control *the_heap, void *starting_address, - size_t size, - uint32_t *amount_extended + intptr_t size, + intptr_t *amount_extended ) { uint32_t the_size; diff --git a/cpukit/score/src/heapresizeblock.c b/cpukit/score/src/heapresizeblock.c index 49460f9767..c744d4ff88 100644 --- a/cpukit/score/src/heapresizeblock.c +++ b/cpukit/score/src/heapresizeblock.c @@ -47,9 +47,9 @@ Heap_Resize_status _Heap_Resize_block( Heap_Control *the_heap, void *starting_address, - size_t size, - uint32_t *old_mem_size, - uint32_t *avail_mem_size + intptr_t size, + intptr_t *old_mem_size, + intptr_t *avail_mem_size ) { Heap_Block *the_block; diff --git a/cpukit/score/src/heapsizeofuserarea.c b/cpukit/score/src/heapsizeofuserarea.c index c1555d2ccc..d7c6f0f9b9 100644 --- a/cpukit/score/src/heapsizeofuserarea.c +++ b/cpukit/score/src/heapsizeofuserarea.c @@ -42,7 +42,7 @@ bool _Heap_Size_of_user_area( Heap_Control *the_heap, void *starting_address, - size_t *size + intptr_t *size ) { Heap_Block *the_block; diff --git a/cpukit/score/src/pheapallocate.c b/cpukit/score/src/pheapallocate.c index a0841bc653..f864a4a435 100644 --- a/cpukit/score/src/pheapallocate.c +++ b/cpukit/score/src/pheapallocate.c @@ -18,7 +18,7 @@ void *_Protected_heap_Allocate( Heap_Control *the_heap, - size_t size + intptr_t size ) { void *p; diff --git a/cpukit/score/src/pheapallocatealigned.c b/cpukit/score/src/pheapallocatealigned.c index 1e1706063b..97873f9b29 100644 --- a/cpukit/score/src/pheapallocatealigned.c +++ b/cpukit/score/src/pheapallocatealigned.c @@ -18,7 +18,7 @@ void *_Protected_heap_Allocate_aligned( Heap_Control *the_heap, - size_t size, + intptr_t size, uint32_t alignment ) { diff --git a/cpukit/score/src/pheapextend.c b/cpukit/score/src/pheapextend.c index 2d8d4ac3a3..d391018d0d 100644 --- a/cpukit/score/src/pheapextend.c +++ b/cpukit/score/src/pheapextend.c @@ -19,11 +19,11 @@ bool _Protected_heap_Extend( Heap_Control *the_heap, void *starting_address, - size_t size + intptr_t size ) { Heap_Extend_status status; - uint32_t amount_extended; + intptr_t amount_extended; _RTEMS_Lock_allocator(); status = _Heap_Extend(the_heap, starting_address, size, &amount_extended); diff --git a/cpukit/score/src/pheapgetblocksize.c b/cpukit/score/src/pheapgetblocksize.c index 029ef7b2c7..0e6cd80ea5 100644 --- a/cpukit/score/src/pheapgetblocksize.c +++ b/cpukit/score/src/pheapgetblocksize.c @@ -19,7 +19,7 @@ bool _Protected_heap_Get_block_size( Heap_Control *the_heap, void *starting_address, - size_t *size + intptr_t *size ) { bool status; diff --git a/cpukit/score/src/pheapresizeblock.c b/cpukit/score/src/pheapresizeblock.c index 589a520e0d..45e7861509 100644 --- a/cpukit/score/src/pheapresizeblock.c +++ b/cpukit/score/src/pheapresizeblock.c @@ -19,12 +19,12 @@ bool _Protected_heap_Resize_block( Heap_Control *the_heap, void *starting_address, - size_t size + intptr_t size ) { Heap_Resize_status status; - uint32_t old_mem_size; - uint32_t avail_mem_size; + intptr_t old_mem_size; + intptr_t avail_mem_size; _RTEMS_Lock_allocator(); status = _Heap_Resize_block( -- cgit v1.2.3