summaryrefslogtreecommitdiff
path: root/src/lib/mpmalloc.cc
blob: 2483a3a3989269fbd565c628db7d3f3505eda01d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdlib.h>
#include "driver/stdout.h"
#include "lib/mpmalloc.h"

void* mpcalloc(size_t nmemb, size_t size)
{
	void* ret = calloc(nmemb, size);
#ifdef ADDR_20BIT
	kout << "calloc:" << dec << (uint32_t)nmemb << "x" << (uint32_t)size << "@" << ret << endl;
#else
	kout << "calloc:" << dec << nmemb << "x" << size << "@" << ret << endl;
#endif
	return ret;
}

void* mpmalloc(size_t size)
{
	void* ret = malloc(size);
#ifdef ADDR_20BIT
	kout << "malloc:" << dec << (uint32_t)size << "@" << ret << endl;
#else
	kout << "malloc:" << dec << size << "@" << ret << endl;
#endif
	return ret;
}

void* mprealloc(void* addr, size_t size)
{
	void* ret = realloc(addr, size);
#ifdef ADDR_20BIT
	kout << "realloc:" << addr << ":" << dec << (uint32_t)size << "@" << ret << endl;
#else
	kout << "realloc:" << addr << ":" << dec << size << "@" << ret << endl;
#endif
	return ret;
}

void mpfree(void* addr)
{
	kout << "free:" << addr << endl;
	free(addr);
}