--- /dev/null
+#include <stdlib.h>
+#include <string.h>
+#include "mem.h"
+
+void *malloc(size_t sz)
+{
+ return mem_alloc(sz, 0);
+}
+
+void *calloc(size_t n, size_t sz)
+{
+ void *p = mem_alloc(n * sz, 0);
+ if(!p) return 0;
+ memset(p, 0, n * sz);
+ return p;
+}
+
+void free(void *p)
+{
+ mem_free(p);
+}
void itoa(int val, char *buf, int base);
void utoa(unsigned int val, char *buf, int base);
+void *malloc(size_t sz);
+void *calloc(size_t n, size_t sz);
+void free(void *p);
+
#endif /* AMIGA_LIBC_STDLIB_H_ */
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "amigalib.h"
#include "hwregs.h"
struct memrange *prev, *next, dummy;
printf("DBG adding free range: %06lx - %06lx to pool %d\n", (unsigned long)mr,
- (unsigned long)(mr->start + mr->size - (unsigned char*)mr), pidx);
+ (unsigned long)(mr->start + mr->size), pidx);
dummy.next = pool[pidx];
prev = &dummy;
pool[pidx] = dummy.next;
}
+
+void dbg_memprint(void)
+{
+ struct memrange *mr = pool[POOL_SLOW];
+
+ printf("MEM");
+ while(mr) {
+ printf(" [%lx - %lx]", (unsigned long)mr, (unsigned long)(mr->start + mr->size));
+ mr = mr->next;
+ }
+ putchar('\n');
+}