Populate the memory map structure
This commit is contained in:
24
src/memory.h
24
src/memory.h
@@ -7,30 +7,30 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
enum MemoryPermissions {
|
||||
typedef enum {
|
||||
HI_MEMORY_READ = 1 << 0,
|
||||
HI_MEMORY_WRITE = 1 << 1,
|
||||
HI_MEMORY_EXECUTE = 1 << 2,
|
||||
HI_MEMORY_SHARED = 1 << 3,
|
||||
HI_MEMORY_PRIVATE = 1 << 4
|
||||
};
|
||||
} MemoryPermissions;
|
||||
|
||||
#define HI_MEM_REG_MAX 256
|
||||
typedef struct {
|
||||
void *region_starts[HI_MEM_REG_MAX];
|
||||
void *region_end[HI_MEM_REG_MAX];
|
||||
u32 region_flags[HI_MEM_REG_MAX]; // enum MemoryPermissions
|
||||
u32 offset[HI_MEM_REG_MAX];
|
||||
str pathname[HI_MEM_REG_MAX];
|
||||
uptr region_starts[HI_MEM_REG_MAX];
|
||||
uptr region_ends[HI_MEM_REG_MAX];
|
||||
uptr offsets[HI_MEM_REG_MAX];
|
||||
u64 inodes[HI_MEM_REG_MAX];
|
||||
u32 permissions[HI_MEM_REG_MAX]; // enum MemoryPermissions
|
||||
const char *pathnames[HI_MEM_REG_MAX];
|
||||
} MemoryRegions;
|
||||
|
||||
|
||||
|
||||
sc_array_def(MemoryRegions, memreg);
|
||||
_Static_assert(sizeof(MemoryRegions) < 1024 * 11, "MemoryRegion size has increased. Fix this assert.");
|
||||
_Static_assert(sizeof(MemoryRegions) < 1024 * 12, "MemoryRegion size has increased. Fix this assert.");
|
||||
|
||||
/* Needed to free the underlying pathnames before clear */
|
||||
void hi_clear_memreg(struct sc_array_memreg *regions);
|
||||
|
||||
/* A pointer that can be used to place the memory regions into. If mr isn't cleared, the content will be cleared. */
|
||||
/* A pointer that can be used to place the memory regions into. Clears regions before use, but uses the same buffer. */
|
||||
HiloadResult read_memory_maps_self(struct sc_array_memreg *regions);
|
||||
|
||||
#endif // MEMORY_H_
|
||||
|
||||
Reference in New Issue
Block a user