Fixing malloc alighment and duplicate calls to NtAllocateVirtualMemory.

This commit is contained in:
Ben Vanik
2013-05-27 19:58:20 -07:00
parent 1d0ec64d40
commit f78e7945d4
3 changed files with 21 additions and 5 deletions

View File

@@ -69,6 +69,14 @@ X_STATUS xeNtAllocateVirtualMemory(
uint32_t adjusted_size = *region_size_ptr;
// TODO(benvanik): adjust based on page size flags/etc?
// TODO(benvanik): support different allocation types.
// Right now we treat everything as a commit and ignore allocations that have
// already happened.
if (*base_addr_ptr) {
// Having a pointer already means that this is likely a follow-on COMMIT.
return X_STATUS_SUCCESS;
}
// Allocate.
uint32_t flags = 0;
uint32_t addr = xe_memory_heap_alloc(
@@ -86,7 +94,6 @@ X_STATUS xeNtAllocateVirtualMemory(
}
// TODO(benvanik): remove state parameter.
SHIM_CALL NtAllocateVirtualMemory_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
uint32_t base_addr_ptr = SHIM_GET_ARG_32(0);