summaryrefslogtreecommitdiff
path: root/Source/Kernel/MemoryManager/Mem.ns.h
blob: e208d655b81e7f5f9d3c7923844cc8d839b58423 (plain) (blame)
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
#ifdef DEF_COMMON

#ifndef DEF_MEM_NS_H
#define DEF_MEM_NS_H

//Heap minimum size : 2M
#define HEAP_MIN_SIZE 0x00200000
//Heap magic number, for verifications
#define HEAP_MAGIC 0xBEEF1337

namespace Mem {
	extern bool pagingEnabled;
	extern u32int placementAddress, kheapFree;

	struct heap_header_t {
		u32int magic;
		bool is_hole;
		u32int size;
	};

	struct heap_footer_t {
		u32int magic;
		heap_header_t *header;
	};

	struct heap_index_t {
		heap_header_t **data;
		u32int size;
	};

	void createHeap();
	void *kalloc(u32int sz, bool align = false);
	void kfree(void *ptr);
}

#endif

#endif