Reworking the memory system to not commit 3gb and to properly alloc data.

Now only 512MB is committed on startup. Loaded XEXs are placed into their
required addresses in the 0x8... range. Kernel structures are allocated
from the normal heap like other data. There should no longer be any magical
pointers.
This commit is contained in:
Ben Vanik
2013-05-29 21:00:55 -07:00
parent 61f7f6d28e
commit 6950b21424
5 changed files with 188 additions and 58 deletions

View File

@@ -28,18 +28,31 @@ xe_memory_ref xe_memory_retain(xe_memory_ref memory);
void xe_memory_release(xe_memory_ref memory);
size_t xe_memory_get_length(xe_memory_ref memory);
uint8_t *xe_memory_addr(xe_memory_ref memory, size_t guest_addr);
uint8_t *xe_memory_addr(xe_memory_ref memory, size_t guest_addr = 0);
uint32_t xe_memory_search_aligned(xe_memory_ref memory, size_t start,
size_t end, const uint32_t *values,
const size_t value_count);
// These methods slice off memory from the virtual address space.
// They should only be used by kernel modules that know what they are doing.
uint32_t xe_memory_heap_alloc(xe_memory_ref memory, uint32_t base_addr,
uint32_t size, uint32_t flags);
uint32_t xe_memory_heap_free(xe_memory_ref memory, uint32_t addr,
uint32_t flags);
// These methods slice off memory from the virtual address space, unless
// base_address is specified in which case they place into an address in
// memory.
enum {
XE_MEMORY_FLAG_64KB_PAGES = (1 << 1),
};
enum {
XE_MEMORY_ACCESS_READ = (1 << 1),
XE_MEMORY_ACCESS_WRITE = (1 << 2)
};
uint32_t xe_memory_heap_alloc(xe_memory_ref memory, uint32_t base_address,
uint32_t size, uint32_t flags);
int xe_memory_heap_free(xe_memory_ref memory, uint32_t addr, uint32_t size);
bool xe_memory_is_valid(xe_memory_ref memory, uint32_t address);
int xe_memory_protect(xe_memory_ref memory, uint32_t address, uint32_t size,
uint32_t access);
#endif // XENIA_CORE_MEMORY_H_