2005-04-09 15:01:09 +00:00
|
|
|
#ifndef BASEMEM_H
|
|
|
|
#define BASEMEM_H
|
|
|
|
|
2005-04-09 16:13:19 +00:00
|
|
|
#ifdef ASSEMBLY
|
|
|
|
|
|
|
|
/* Must match sizeof(struct free_base_memory_header) */
|
|
|
|
#define FREE_BASEMEM_HEADER_SIZE 8
|
|
|
|
|
|
|
|
#else /* ASSEMBLY */
|
|
|
|
|
2005-04-09 15:01:09 +00:00
|
|
|
#include "stdint.h"
|
|
|
|
|
2005-04-09 16:13:19 +00:00
|
|
|
/* Structures that we use to represent a free block of base memory */
|
|
|
|
|
|
|
|
#define FREE_BLOCK_MAGIC ( ('!'<<0) + ('F'<<8) + ('R'<<16) + ('E'<<24) )
|
|
|
|
struct free_base_memory_header {
|
|
|
|
uint32_t magic;
|
|
|
|
uint32_t size_kb;
|
|
|
|
};
|
|
|
|
|
|
|
|
union free_base_memory_block {
|
2005-05-23 23:47:54 +00:00
|
|
|
struct free_base_memory_header header;
|
2005-04-09 16:13:19 +00:00
|
|
|
char bytes[1024];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Function prototypes */
|
2005-04-18 09:17:27 +00:00
|
|
|
extern unsigned int get_free_base_memory ( void );
|
2005-04-09 15:01:09 +00:00
|
|
|
extern void * alloc_base_memory ( size_t size );
|
|
|
|
extern void free_base_memory ( void *ptr, size_t size );
|
|
|
|
|
2005-04-09 16:13:19 +00:00
|
|
|
#endif /* ASSEMBLY */
|
|
|
|
|
2005-04-09 15:01:09 +00:00
|
|
|
#endif /* BASEMEM_H */
|