forked from Imagelibrary/rtems
uses address object rather than direct pointer arithmetic
This commit is contained in:
@@ -149,7 +149,8 @@ Heap_Extend_status _Heap_Extend(
|
|||||||
|
|
||||||
} else { /* cases 4 and 5 */
|
} else { /* cases 4 and 5 */
|
||||||
|
|
||||||
the_block = (Heap_Block *) (starting_address - HEAP_OVERHEAD);
|
the_block = (Heap_Block *)
|
||||||
|
_Addresses_Subtract_offset( starting_address, HEAP_OVERHEAD );
|
||||||
if ( the_block != the_heap->final )
|
if ( the_block != the_heap->final )
|
||||||
return HEAP_EXTEND_NOT_IMPLEMENTED; /* case 5 */
|
return HEAP_EXTEND_NOT_IMPLEMENTED; /* case 5 */
|
||||||
}
|
}
|
||||||
@@ -258,7 +259,7 @@ void *_Heap_Allocate(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
offset = the_heap->page_size - (((unsigned32) ptr) & (the_heap->page_size - 1));
|
offset = the_heap->page_size - (((unsigned32) ptr) & (the_heap->page_size - 1));
|
||||||
ptr += offset;
|
ptr = _Addresses_Add_offset( ptr, offset );
|
||||||
*(((unsigned32 *) ptr) - 1) = offset;
|
*(((unsigned32 *) ptr) - 1) = offset;
|
||||||
|
|
||||||
#ifdef RTEMS_DEBUG
|
#ifdef RTEMS_DEBUG
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ Heap_Extend_status _Heap_Extend(
|
|||||||
|
|
||||||
} else { /* cases 4 and 5 */
|
} else { /* cases 4 and 5 */
|
||||||
|
|
||||||
the_block = (Heap_Block *) (starting_address - HEAP_OVERHEAD);
|
the_block = (Heap_Block *)
|
||||||
|
_Addresses_Subtract_offset( starting_address, HEAP_OVERHEAD );
|
||||||
if ( the_block != the_heap->final )
|
if ( the_block != the_heap->final )
|
||||||
return HEAP_EXTEND_NOT_IMPLEMENTED; /* case 5 */
|
return HEAP_EXTEND_NOT_IMPLEMENTED; /* case 5 */
|
||||||
}
|
}
|
||||||
@@ -258,7 +259,7 @@ void *_Heap_Allocate(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
offset = the_heap->page_size - (((unsigned32) ptr) & (the_heap->page_size - 1));
|
offset = the_heap->page_size - (((unsigned32) ptr) & (the_heap->page_size - 1));
|
||||||
ptr += offset;
|
ptr = _Addresses_Add_offset( ptr, offset );
|
||||||
*(((unsigned32 *) ptr) - 1) = offset;
|
*(((unsigned32 *) ptr) - 1) = offset;
|
||||||
|
|
||||||
#ifdef RTEMS_DEBUG
|
#ifdef RTEMS_DEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user