diff options
| -rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/shared_memory.h | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 2 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 62861da36..273e6a25e 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp | |||
| @@ -119,7 +119,15 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi | |||
| 119 | ConvertPermissions(permissions)); | 119 | ConvertPermissions(permissions)); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | ResultCode SharedMemory::Unmap(Process& target_process, VAddr address) { | 122 | ResultCode SharedMemory::Unmap(Process& target_process, VAddr address, u64 unmap_size) { |
| 123 | if (unmap_size != size) { | ||
| 124 | LOG_ERROR(Kernel, | ||
| 125 | "Invalid size passed to Unmap. Size must be equal to the size of the " | ||
| 126 | "memory managed. Shared memory size=0x{:016X}, Unmap size=0x{:016X}", | ||
| 127 | size, unmap_size); | ||
| 128 | return ERR_INVALID_SIZE; | ||
| 129 | } | ||
| 130 | |||
| 123 | // TODO(Subv): Verify what happens if the application tries to unmap an address that is not | 131 | // TODO(Subv): Verify what happens if the application tries to unmap an address that is not |
| 124 | // mapped to a SharedMemory. | 132 | // mapped to a SharedMemory. |
| 125 | return target_process.VMManager().UnmapRange(address, size); | 133 | return target_process.VMManager().UnmapRange(address, size); |
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index dab2a6bea..37e18c443 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h | |||
| @@ -104,11 +104,17 @@ public: | |||
| 104 | 104 | ||
| 105 | /** | 105 | /** |
| 106 | * Unmaps a shared memory block from the specified address in system memory | 106 | * Unmaps a shared memory block from the specified address in system memory |
| 107 | * | ||
| 107 | * @param target_process Process from which to unmap the memory block. | 108 | * @param target_process Process from which to unmap the memory block. |
| 108 | * @param address Address in system memory where the shared memory block is mapped | 109 | * @param address Address in system memory where the shared memory block is mapped. |
| 110 | * @param unmap_size The amount of bytes to unmap from this shared memory instance. | ||
| 111 | * | ||
| 109 | * @return Result code of the unmap operation | 112 | * @return Result code of the unmap operation |
| 113 | * | ||
| 114 | * @pre The given size to unmap must be the same size as the amount of memory managed by | ||
| 115 | * the SharedMemory instance itself, otherwise ERR_INVALID_SIZE will be returned. | ||
| 110 | */ | 116 | */ |
| 111 | ResultCode Unmap(Process& target_process, VAddr address); | 117 | ResultCode Unmap(Process& target_process, VAddr address, u64 unmap_size); |
| 112 | 118 | ||
| 113 | /** | 119 | /** |
| 114 | * Gets a pointer to the shared memory block | 120 | * Gets a pointer to the shared memory block |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 11796e5e5..fd98c0825 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -1140,7 +1140,7 @@ static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 | |||
| 1140 | return ERR_INVALID_MEMORY_RANGE; | 1140 | return ERR_INVALID_MEMORY_RANGE; |
| 1141 | } | 1141 | } |
| 1142 | 1142 | ||
| 1143 | return shared_memory->Unmap(*current_process, addr); | 1143 | return shared_memory->Unmap(*current_process, addr, size); |
| 1144 | } | 1144 | } |
| 1145 | 1145 | ||
| 1146 | static ResultCode QueryProcessMemory(VAddr memory_info_address, VAddr page_info_address, | 1146 | static ResultCode QueryProcessMemory(VAddr memory_info_address, VAddr page_info_address, |