git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cut down on debug, fixed tabs, made process tree be killed when root is killed
[tpg/acess2.git]
/
Kernel
/
heap.c
diff --git
a/Kernel/heap.c
b/Kernel/heap.c
index
6823918
..
79f5f40
100644
(file)
--- a/
Kernel/heap.c
+++ b/
Kernel/heap.c
@@
-7,6
+7,7
@@
#include <heap.h>
#define WARNINGS 1
#include <heap.h>
#define WARNINGS 1
+#define DEBUG_TRACE 0
// === CONSTANTS ===
#define HEAP_BASE 0xE0800000
// === 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(head->Size == Bytes) {
head->Magic = MAGIC_USED;
RELEASE(&giHeapSpinlock); // Release spinlock
- LOG("RETURN %p", best->Data);
+ #if DEBUG_TRACE
+ LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0));
+ #endif
return best->Data;
}
return best->Data;
}
@@
-205,7
+208,9
@@
void *malloc(size_t Bytes)
// Check size
if(best->Size == Bytes) {
RELEASE(&giHeapSpinlock); // Release spinlock
// Check size
if(best->Size == Bytes) {
RELEASE(&giHeapSpinlock); // Release spinlock
- LOG("RETURN %p", best->Data);
+ #if DEBUG_TRACE
+ LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0));
+ #endif
return best->Data;
}
}
return best->Data;
}
}
@@
-224,7
+229,9
@@
void *malloc(size_t Bytes)
best->Magic = MAGIC_USED; // Mark block as used
RELEASE(&giHeapSpinlock); // Release spinlock
best->Magic = MAGIC_USED; // Mark block as used
RELEASE(&giHeapSpinlock); // Release spinlock
- LOG("RETURN %p", best->Data);
+ #if DEBUG_TRACE
+ LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0));
+ #endif
return best->Data;
}
return best->Data;
}
@@
-237,12
+244,14
@@
void free(void *Ptr)
tHeapHead *head;
tHeapFoot *foot;
tHeapHead *head;
tHeapFoot *foot;
+ #if DEBUG_TRACE
LOG("Ptr = %p", Ptr);
LOG("Returns to %p", __builtin_return_address(0));
LOG("Ptr = %p", Ptr);
LOG("Returns to %p", __builtin_return_address(0));
+ #endif
// Alignment Check
if( (Uint)Ptr & (sizeof(Uint)-1) ) {
// Alignment Check
if( (Uint)Ptr & (sizeof(Uint)-1) ) {
- Warning("free - Passed a non-aligned address (%p)
\n
", Ptr);
+ Warning("free - Passed a non-aligned address (%p)", Ptr);
return;
}
return;
}
@@
-256,7
+265,7
@@
void free(void *Ptr)
// Check memory block - Header
head = (void*)( (Uint)Ptr - sizeof(tHeapHead) );
if(head->Magic == MAGIC_FREE) {
// Check memory block - Header
head = (void*)( (Uint)Ptr - sizeof(tHeapHead) );
if(head->Magic == MAGIC_FREE) {
- Warning("free - Passed a freed block (%p)
\n", head
);
+ Warning("free - Passed a freed block (%p)
by %p", head, __builtin_return_address(0)
);
return;
}
if(head->Magic != MAGIC_USED) {
return;
}
if(head->Magic != MAGIC_USED) {
UCC
git Repository :: git.ucc.asn.au