summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/kernel/shared_memory.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index c1e0e556b..2b6007caa 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -77,17 +77,23 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
77 77
78 // Error out if the requested permissions don't match what the creator process allows. 78 // Error out if the requested permissions don't match what the creator process allows.
79 if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) { 79 if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) {
80 LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s, permissions don't match",
81 GetObjectId(), address, name.c_str());
80 return ResultCode(ErrorDescription::InvalidCombination, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage); 82 return ResultCode(ErrorDescription::InvalidCombination, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage);
81 } 83 }
82 84
83 // Heap-backed memory blocks can not be mapped with other_permissions = DontCare 85 // Heap-backed memory blocks can not be mapped with other_permissions = DontCare
84 if (base_address != 0 && other_permissions == MemoryPermission::DontCare) { 86 if (base_address != 0 && other_permissions == MemoryPermission::DontCare) {
87 LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s, permissions don't match",
88 GetObjectId(), address, name.c_str());
85 return ResultCode(ErrorDescription::InvalidCombination, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage); 89 return ResultCode(ErrorDescription::InvalidCombination, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage);
86 } 90 }
87 91
88 // Error out if the provided permissions are not compatible with what the creator process needs. 92 // Error out if the provided permissions are not compatible with what the creator process needs.
89 if (other_permissions != MemoryPermission::DontCare && 93 if (other_permissions != MemoryPermission::DontCare &&
90 static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) { 94 static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) {
95 LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s, permissions don't match",
96 GetObjectId(), address, name.c_str());
91 return ResultCode(ErrorDescription::WrongPermission, ErrorModule::OS, ErrorSummary::WrongArgument, ErrorLevel::Permanent); 97 return ResultCode(ErrorDescription::WrongPermission, ErrorModule::OS, ErrorSummary::WrongArgument, ErrorLevel::Permanent);
92 } 98 }
93 99
@@ -117,8 +123,11 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
117 123
118 // Map the memory block into the target process 124 // Map the memory block into the target process
119 auto result = target_process->vm_manager.MapMemoryBlock(target_address, backing_block, backing_block_offset, size, MemoryState::Shared); 125 auto result = target_process->vm_manager.MapMemoryBlock(target_address, backing_block, backing_block_offset, size, MemoryState::Shared);
120 if (result.Failed()) 126 if (result.Failed()) {
127 LOG_ERROR(Kernel, "cannot map id=%u, target_address=0x%08X name=%s, error mapping to virtual memory",
128 GetObjectId(), target_address, name.c_str());
121 return result.Code(); 129 return result.Code();
130 }
122 131
123 return target_process->vm_manager.ReprotectRange(target_address, size, ConvertPermissions(permissions)); 132 return target_process->vm_manager.ReprotectRange(target_address, size, ConvertPermissions(permissions));
124} 133}