mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-10-30 07:29:02 -05:00 
			
		
		
		
	kernel/shared_memory: Return ERR_INVALID_MEMORY_PERMISSIONS instead of ERR_INVALID_COMBINATION
This is more consistent with what the kernel does.
This commit is contained in:
		| @@ -80,20 +80,19 @@ SharedPtr<SharedMemory> SharedMemory::CreateForApplet( | |||||||
|  |  | ||||||
| ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermission permissions, | ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermission permissions, | ||||||
|                              MemoryPermission other_permissions) { |                              MemoryPermission other_permissions) { | ||||||
|  |     const MemoryPermission own_other_permissions = | ||||||
|     MemoryPermission own_other_permissions = |  | ||||||
|         target_process == owner_process ? this->permissions : this->other_permissions; |         target_process == owner_process ? this->permissions : this->other_permissions; | ||||||
|  |  | ||||||
|     // Automatically allocated memory blocks can only be mapped with other_permissions = DontCare |     // Automatically allocated memory blocks can only be mapped with other_permissions = DontCare | ||||||
|     if (base_address == 0 && other_permissions != MemoryPermission::DontCare) { |     if (base_address == 0 && other_permissions != MemoryPermission::DontCare) { | ||||||
|         return ERR_INVALID_COMBINATION; |         return ERR_INVALID_MEMORY_PERMISSIONS; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Error out if the requested permissions don't match what the creator process allows. |     // Error out if the requested permissions don't match what the creator process allows. | ||||||
|     if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) { |     if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) { | ||||||
|         LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", |         LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", | ||||||
|                   GetObjectId(), address, name); |                   GetObjectId(), address, name); | ||||||
|         return ERR_INVALID_COMBINATION; |         return ERR_INVALID_MEMORY_PERMISSIONS; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Error out if the provided permissions are not compatible with what the creator process needs. |     // Error out if the provided permissions are not compatible with what the creator process needs. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Lioncash
					Lioncash