2024-02-18 13:38:08 +01:00
|
|
|
#ifndef MEMORY_H
|
2024-02-18 01:20:00 +01:00
|
|
|
#define MEMORY_H
|
|
|
|
|
|
|
|
#include <types.h>
|
|
|
|
|
2024-02-18 13:38:08 +01:00
|
|
|
#define EXTMEMBOT 0x100000
|
|
|
|
#define PHYSMEMTOP 0x0e000000
|
|
|
|
|
2024-02-18 01:20:00 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Each allocated memory is stored internally like this:
|
|
|
|
* nnnnssss(u)+
|
|
|
|
* n represents the address to the next string
|
|
|
|
* s represents the size of the allocated memory
|
|
|
|
* c
|
|
|
|
* u represents the actual string
|
|
|
|
*
|
|
|
|
* A struct cannot be plainly used because we would have to store a reference
|
|
|
|
* so this complicated structure is utilized instead.
|
|
|
|
*/
|
|
|
|
|
2024-02-18 16:30:09 +01:00
|
|
|
#define START 0xb80f0
|
2024-02-18 15:02:57 +01:00
|
|
|
#define SIZE 16384
|
2024-02-18 01:20:00 +01:00
|
|
|
|
2024-02-18 17:03:57 +01:00
|
|
|
/*
|
|
|
|
* How memory is mapped
|
|
|
|
*/
|
|
|
|
#define STACK_START 0x000b8fa0
|
|
|
|
#define STACK_END 0x000fffff
|
|
|
|
#define PR_START 0x00100000
|
2024-02-18 17:14:38 +01:00
|
|
|
#define MALLOC_END 0x00100fff
|
2024-02-18 17:03:57 +01:00
|
|
|
#define PHYSMEMTOP 0x0e000000
|
|
|
|
|
2024-02-18 16:30:09 +01:00
|
|
|
struct allocated {
|
|
|
|
void *ref;
|
|
|
|
s32 size;
|
|
|
|
}
|
2024-02-18 01:20:00 +01:00
|
|
|
|
2024-02-18 17:14:38 +01:00
|
|
|
void memory_init(void);
|
|
|
|
|
2024-02-18 01:20:00 +01:00
|
|
|
#endif
|