aboutsummaryrefslogtreecommitdiff
path: root/include/lib/mem.h
blob: 655e648485120c52a33b2ace0d633a29a418a18d (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
43
44
45
46
47
48
#ifndef LIB_MEM_H
#define LIB_MEM_H

#define MEM_SIZE_OFFSET 0
#define MEM_USE_OFFSET 1
#define MEM_BASE_SIZE 2
#define MEM_META_SIZE 3
#define NULL 0
#define MAX_MM 0x100000

struct MemTab {
	unsigned char size;
	unsigned char in_use;
	void* data;
} __attribute__((packed));

struct RotBuffer {
	void* base;
	unsigned int size;
	unsigned int roffset;
	unsigned int woffset;
};

void memshow(unsigned char* addr, unsigned int n);
void memset(unsigned char* dest, unsigned char value, unsigned int n);
void memcpy(unsigned char* src, unsigned char* dest, unsigned int n);
unsigned char memcmp(unsigned char* a, unsigned char* b, unsigned int n);
void memcpyrot(unsigned char* src, struct RotBuffer* rb, unsigned int n);

void memshow32(unsigned long* addr, unsigned int n);
void memset32(unsigned long* dest, unsigned long value, unsigned int n);
void memcpy32(unsigned long* src, unsigned long* dest, unsigned int n);
unsigned char memcmp32(unsigned long* a, unsigned long* b, unsigned int n);

void* realloc(void* old, unsigned char size);
void* malloc(unsigned char size);
void* calloc(unsigned char size);
void* realloca(void* old, unsigned char size, unsigned char amnt);
void* malloca(unsigned char size, unsigned char amnt);
void* calloca(unsigned char size, unsigned char amnt);
void free(void* memloc);
void* heap_base(void);
void* heap_top(void);
void vheap_info(void);
void heap_info(void);
void heap_info_u(void);

#endif