mirror of
https://github.com/wiiu-env/MemoryMappingModule.git
synced 2024-11-21 17:29:21 +01:00
Remove allocMutex to avoid possible deadlocks
This commit is contained in:
parent
bf99541449
commit
86c1d20863
@ -12,7 +12,7 @@
|
||||
|
||||
// #define DEBUG_FUNCTION_LINE(x,...)
|
||||
|
||||
OSMutex allocMutex;
|
||||
//OSMutex allocMutex;
|
||||
|
||||
void runOnAllCores(CThread::Callback callback, void *callbackArg, int32_t iAttr = 0, int32_t iPriority = 16, int32_t iStackSize = 0x8000) {
|
||||
int32_t aff[] = {CThread::eAttributeAffCore2, CThread::eAttributeAffCore1, CThread::eAttributeAffCore0};
|
||||
@ -552,14 +552,14 @@ void MemoryMapping_setupMemoryMapping() {
|
||||
//readTestValuesFromMemory();
|
||||
|
||||
//runOnAllCores(writeSegmentRegister,&srTableCpy);
|
||||
OSInitMutex(&allocMutex);
|
||||
// OSInitMutex(&allocMutex);
|
||||
|
||||
memset(pageTableCpy, 0, sizePageTable);
|
||||
gMEMFreeToDefaultHeapForThreads(pageTableCpy);
|
||||
}
|
||||
|
||||
void *MemoryMapping_allocEx(uint32_t size, int32_t align, bool videoOnly) {
|
||||
OSLockMutex(&allocMutex);
|
||||
//OSLockMutex(&allocMutex);
|
||||
void *res = nullptr;
|
||||
for (int32_t i = 0; /* waiting for a break */; i++) {
|
||||
if (mem_mapping[i].physical_addresses == nullptr) {
|
||||
@ -587,7 +587,7 @@ void *MemoryMapping_allocEx(uint32_t size, int32_t align, bool videoOnly) {
|
||||
}
|
||||
}
|
||||
OSMemoryBarrier();
|
||||
OSUnlockMutex(&allocMutex);
|
||||
//OSUnlockMutex(&allocMutex);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -659,7 +659,7 @@ bool CheckMemExpHeap(MEMExpHeap *heap) {
|
||||
}
|
||||
|
||||
void MemoryMapping_checkHeaps() {
|
||||
OSLockMutex(&allocMutex);
|
||||
//OSLockMutex(&allocMutex);
|
||||
for (int32_t i = 0; /* waiting for a break */; i++) {
|
||||
if (mem_mapping[i].physical_addresses == nullptr) {
|
||||
break;
|
||||
@ -672,7 +672,7 @@ void MemoryMapping_checkHeaps() {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
OSUnlockMutex(&allocMutex);
|
||||
//OSUnlockMutex(&allocMutex);
|
||||
}
|
||||
|
||||
void *MemoryMapping_alloc(uint32_t size, int32_t align) {
|
||||
@ -710,7 +710,7 @@ void MemoryMapping_free(void *ptr) {
|
||||
if (ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
OSLockMutex(&allocMutex);
|
||||
//OSLockMutex(&allocMutex);
|
||||
auto ptr_val = (uint32_t) ptr;
|
||||
for (int32_t i = 0; /* waiting for a break */; i++) {
|
||||
if (mem_mapping[i].physical_addresses == nullptr) {
|
||||
@ -723,7 +723,7 @@ void MemoryMapping_free(void *ptr) {
|
||||
}
|
||||
}
|
||||
OSMemoryBarrier();
|
||||
OSUnlockMutex(&allocMutex);
|
||||
//OSUnlockMutex(&allocMutex);
|
||||
}
|
||||
|
||||
uint32_t MemoryMapping_MEMGetAllocatableSize() {
|
||||
@ -731,7 +731,7 @@ uint32_t MemoryMapping_MEMGetAllocatableSize() {
|
||||
}
|
||||
|
||||
uint32_t MemoryMapping_MEMGetAllocatableSizeEx(uint32_t align) {
|
||||
OSLockMutex(&allocMutex);
|
||||
//OSLockMutex(&allocMutex);
|
||||
uint32_t res = 0;
|
||||
for (int32_t i = 0; /* waiting for a break */; i++) {
|
||||
if (mem_mapping[i].physical_addresses == nullptr) {
|
||||
@ -743,12 +743,12 @@ uint32_t MemoryMapping_MEMGetAllocatableSizeEx(uint32_t align) {
|
||||
res = curRes;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex(&allocMutex);
|
||||
//OSUnlockMutex(&allocMutex);
|
||||
return res;
|
||||
}
|
||||
|
||||
uint32_t MemoryMapping_GetFreeSpace() {
|
||||
OSLockMutex(&allocMutex);
|
||||
//OSLockMutex(&allocMutex);
|
||||
uint32_t res = 0;
|
||||
for (int32_t i = 0; /* waiting for a break */; i++) {
|
||||
if (mem_mapping[i].physical_addresses == nullptr) {
|
||||
@ -758,12 +758,12 @@ uint32_t MemoryMapping_GetFreeSpace() {
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("heap at %08X MEMGetTotalFreeSizeForExpHeap: %d KiB", mem_mapping[i].effective_start_address, curRes / 1024);
|
||||
res += curRes;
|
||||
}
|
||||
OSUnlockMutex(&allocMutex);
|
||||
//OSUnlockMutex(&allocMutex);
|
||||
return res;
|
||||
}
|
||||
|
||||
void MemoryMapping_CreateHeaps() {
|
||||
OSLockMutex(&allocMutex);
|
||||
//OSLockMutex(&allocMutex);
|
||||
for (int32_t i = 0; /* waiting for a break */; i++) {
|
||||
if (mem_mapping[i].physical_addresses == nullptr) {
|
||||
break;
|
||||
@ -780,11 +780,11 @@ void MemoryMapping_CreateHeaps() {
|
||||
DEBUG_FUNCTION_LINE("Created heap @%08X, size %d KiB", heap, size / 1024);
|
||||
#endif
|
||||
}
|
||||
OSUnlockMutex(&allocMutex);
|
||||
//OSUnlockMutex(&allocMutex);
|
||||
}
|
||||
|
||||
void MemoryMapping_DestroyHeaps() {
|
||||
OSLockMutex(&allocMutex);
|
||||
//OSLockMutex(&allocMutex);
|
||||
for (int32_t i = 0; /* waiting for a break */; i++) {
|
||||
if (mem_mapping[i].physical_addresses == nullptr) {
|
||||
break;
|
||||
@ -796,7 +796,7 @@ void MemoryMapping_DestroyHeaps() {
|
||||
memset(address, 0, size);
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Destroyed heap @%08X", address);
|
||||
}
|
||||
OSUnlockMutex(&allocMutex);
|
||||
//OSUnlockMutex(&allocMutex);
|
||||
}
|
||||
|
||||
uint32_t MemoryMapping_getAreaSizeFromPageTable(uint32_t start, uint32_t maxSize) {
|
||||
|
Loading…
Reference in New Issue
Block a user