|
@@ -1,10 +1,33 @@
|
1
|
1
|
#ifndef BASEMEM_H
|
2
|
2
|
#define BASEMEM_H
|
3
|
3
|
|
|
4
|
+#ifdef ASSEMBLY
|
|
5
|
+
|
|
6
|
+/* Must match sizeof(struct free_base_memory_header) */
|
|
7
|
+#define FREE_BASEMEM_HEADER_SIZE 8
|
|
8
|
+
|
|
9
|
+#else /* ASSEMBLY */
|
|
10
|
+
|
4
|
11
|
#include "stdint.h"
|
5
|
12
|
|
|
13
|
+/* Structures that we use to represent a free block of base memory */
|
|
14
|
+
|
|
15
|
+#define FREE_BLOCK_MAGIC ( ('!'<<0) + ('F'<<8) + ('R'<<16) + ('E'<<24) )
|
|
16
|
+struct free_base_memory_header {
|
|
17
|
+ uint32_t magic;
|
|
18
|
+ uint32_t size_kb;
|
|
19
|
+};
|
|
20
|
+
|
|
21
|
+union free_base_memory_block {
|
|
22
|
+ struct free_base_memory_header;
|
|
23
|
+ char bytes[1024];
|
|
24
|
+};
|
|
25
|
+
|
|
26
|
+/* Function prototypes */
|
6
|
27
|
extern uint32_t get_free_base_memory ( void );
|
7
|
28
|
extern void * alloc_base_memory ( size_t size );
|
8
|
29
|
extern void free_base_memory ( void *ptr, size_t size );
|
9
|
30
|
|
|
31
|
+#endif /* ASSEMBLY */
|
|
32
|
+
|
10
|
33
|
#endif /* BASEMEM_H */
|