#include <heap.h>
#define WARNINGS 1
+#define DEBUG_TRACE 0
// === CONSTANTS ===
#define HEAP_BASE 0xE0800000
if(head->Size == Bytes) {
head->Magic = MAGIC_USED;
RELEASE(&giHeapSpinlock); // Release spinlock
+ #if DEBUG_TRACE
LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0));
+ #endif
return best->Data;
}
// Check size
if(best->Size == Bytes) {
RELEASE(&giHeapSpinlock); // Release spinlock
+ #if DEBUG_TRACE
LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0));
+ #endif
return best->Data;
}
}
best->Magic = MAGIC_USED; // Mark block as used
RELEASE(&giHeapSpinlock); // Release spinlock
+ #if DEBUG_TRACE
LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0));
+ #endif
return best->Data;
}
tHeapHead *head;
tHeapFoot *foot;
+ #if DEBUG_TRACE
LOG("Ptr = %p", Ptr);
LOG("Returns to %p", __builtin_return_address(0));
+ #endif
// Alignment Check
if( (Uint)Ptr & (sizeof(Uint)-1) ) {