From c6668f5ce555ff5550fa3d9ab1462e5a625f832c Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 25 Sep 2009 14:29:34 +0800 Subject: [PATCH] Disabled trace debugging for heap --- Kernel/heap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Kernel/heap.c b/Kernel/heap.c index 30c812e4..fbff88b2 100644 --- a/Kernel/heap.c +++ b/Kernel/heap.c @@ -7,6 +7,7 @@ #include #define WARNINGS 1 +#define DEBUG_TRACE 0 // === CONSTANTS === #define HEAP_BASE 0xE0800000 @@ -175,7 +176,9 @@ void *malloc(size_t Bytes) 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; } @@ -205,7 +208,9 @@ void *malloc(size_t Bytes) // 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; } } @@ -224,7 +229,9 @@ void *malloc(size_t Bytes) 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; } @@ -237,8 +244,10 @@ void free(void *Ptr) 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) ) { -- 2.20.1