Fix the alloc and free functions to use all heaps

This commit is contained in:
Maschell 2020-05-30 21:45:05 +02:00
parent 5d38198e41
commit 667a90d7ed

View File

@ -376,7 +376,7 @@ void* MemoryMapping::alloc(uint32_t size, uint32_t align){
DEBUG_FUNCTION_LINE("break %d",i); DEBUG_FUNCTION_LINE("break %d",i);
break; break;
} }
res = MEMAllocFromExpHeapEx((MEMHeapHandle) mem_mapping->effective_start_address, size, align); res = MEMAllocFromExpHeapEx((MEMHeapHandle) mem_mapping[i].effective_start_address, size, align);
if (res != NULL) { if (res != NULL) {
break; break;
} }
@ -395,8 +395,8 @@ void MemoryMapping::free(void* ptr){
DEBUG_FUNCTION_LINE("break %d",i); DEBUG_FUNCTION_LINE("break %d",i);
break; break;
} }
if(ptr_val > mem_mapping->effective_start_address && ptr_val < mem_mapping->effective_end_address){ if(ptr_val > mem_mapping[i].effective_start_address && ptr_val < mem_mapping[i].effective_end_address){
MEMFreeToExpHeap((MEMHeapHandle) mem_mapping->effective_start_address, ptr); MEMFreeToExpHeap((MEMHeapHandle) mem_mapping[i].effective_start_address, ptr);
break; break;
} }
} }