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
Added full ANSI colour range
[tpg/acess2.git]
/
Kernel
/
heap.c
diff --git
a/Kernel/heap.c
b/Kernel/heap.c
index
fce510c
..
90b7256
100644
(file)
--- a/
Kernel/heap.c
+++ b/
Kernel/heap.c
@@
-175,6
+175,7
@@
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);
return best->Data;
}
return best->Data;
}
@@
-204,6
+205,7
@@
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);
return best->Data;
}
}
return best->Data;
}
}
@@
-222,6
+224,7
@@
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);
return best->Data;
}
return best->Data;
}
@@
-234,6
+237,9
@@
void free(void *Ptr)
tHeapHead *head;
tHeapFoot *foot;
tHeapHead *head;
tHeapFoot *foot;
+ LOG("Ptr = %p", Ptr);
+ LOG("Returns to %p", __builtin_return_address(0));
+
// Alignment Check
if( (Uint)Ptr & (sizeof(Uint)-1) ) {
Warning("free - Passed a non-aligned address (%p)\n", Ptr);
// Alignment Check
if( (Uint)Ptr & (sizeof(Uint)-1) ) {
Warning("free - Passed a non-aligned address (%p)\n", Ptr);
UCC
git Repository :: git.ucc.asn.au