Changed the x86 architecture to have tPAddr be 64-bits always
[tpg/acess2.git] / Kernel / heap.c
index 79f5f40..a8fdd53 100644 (file)
@@ -280,7 +280,7 @@ void free(void *Ptr)
                return;
        }
        if(foot->Magic != MAGIC_FOOT) {
-               Warning("free - Footer magic is invalid (%p, 0x%x)\n", head, foot->Magic);
+               Warning("free - Footer magic is invalid (%p, %p = 0x%x)\n", head, &foot->Magic, foot->Magic);
                return;
        }
        
@@ -368,6 +368,22 @@ void *realloc(void *__ptr, size_t __size)
        return NULL;
 }
 
+/**
+ * \fn void *calloc(size_t num, size_t size)
+ * \brief Allocate and Zero a buffer in memory
+ * \param num  Number of elements
+ * \param size Size of each element
+ */
+void *calloc(size_t num, size_t size)
+{
+       void    *ret = malloc(num*size);
+       if(ret == NULL) return NULL;
+       
+       memset( ret, 0, num*size );
+       
+       return ret;
+}
+
 /**
  * \fn int IsHeap(void *Ptr)
  * \brief Checks if an address is a heap address
@@ -428,3 +444,8 @@ void Heap_Dump()
        }
 }
 #endif
+
+// === EXPORTS ===
+EXPORT(malloc);
+EXPORT(realloc);
+EXPORT(free);

UCC git Repository :: git.ucc.asn.au