mirror of
https://github.com/wiiu-env/MemoryMappingModule.git
synced 2024-11-25 03:06:54 +01:00
Fix KiGetOrPutUserData
This commit is contained in:
parent
88de314828
commit
3a8d8a979c
@ -56,17 +56,22 @@ DECL_FUNCTION(uint32_t, KiIsEffectiveRangeValid, uint32_t addressSpace, uint32_t
|
||||
// clang-format on
|
||||
|
||||
DECL_FUNCTION(uint32_t, KiGetOrPutUserData, void *src, uint32_t size, void *dst, bool isRead) {
|
||||
//
|
||||
if (isRead && MemoryMapping_EffectiveToPhysical((uint32_t) src) > 0) {
|
||||
k_memcpy(dst, src, size);
|
||||
return 1;
|
||||
} else if (!isRead && MemoryMapping_EffectiveToPhysical((uint32_t) dst) > 0) {
|
||||
// src and dst are swapped here
|
||||
k_memcpy(src, dst, size);
|
||||
if (real_KiGetOrPutUserData(src, size, dst, isRead)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return real_KiGetOrPutUserData(src, size, dst, isRead);
|
||||
// check if the src (src is the destication for writes) buffer is valid
|
||||
if (MemoryMapping_EffectiveToPhysical((uint32_t) src) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (isRead) {
|
||||
k_memcpy(dst, src, size);
|
||||
} else if (!isRead && MemoryMapping_EffectiveToPhysical((uint32_t) src) > 0) {
|
||||
// src and dst are swapped here
|
||||
k_memcpy(src, dst, size);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(MEMHeapHandle, MEMFindContainHeap, void *block) {
|
||||
|
Loading…
Reference in New Issue
Block a user