unmake str as submodule

This commit is contained in:
2025-03-19 21:57:27 +02:00
parent 3ecd88fe72
commit cf8b57cd57
6 changed files with 1175 additions and 14 deletions

View File

@@ -5,6 +5,8 @@
#include "types.h"
#include "array.h"
#include <assert.h>
enum MemoryPermissions {
HI_MEMORY_READ = 1 << 0,
HI_MEMORY_WRITE = 1 << 1,
@@ -13,13 +15,22 @@ enum MemoryPermissions {
HI_MEMORY_PRIVATE = 1 << 4
};
#define REGIONS_MAX 256
#define HI_MEM_REG_MAX 256
typedef struct {
void *region_starts[REGIONS_MAX];
void *region_end[REGIONS_MAX];
u32 region_flags[REGIONS_MAX]; // enum MemoryPermissions
u32 offset[REGIONS_MAX];
str pathname[REGIONS_MAX];
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];
} MemoryRegions;
sc_array_def(MemoryRegions, memreg);
_Static_assert(sizeof(MemoryRegions) < 1024 * 11, "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. */
HiloadResult read_memory_maps_self(struct sc_array_memreg *regions);
#endif // MEMORY_H_