diff options
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/kernel/shared_memory.h | 2 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 4137683b5..1f477664b 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp | |||
| @@ -20,6 +20,7 @@ SharedPtr<SharedMemory> SharedMemory::Create(u32 size, MemoryPermission permissi | |||
| 20 | 20 | ||
| 21 | shared_memory->name = std::move(name); | 21 | shared_memory->name = std::move(name); |
| 22 | shared_memory->base_address = 0x0; | 22 | shared_memory->base_address = 0x0; |
| 23 | shared_memory->fixed_address = 0x0; | ||
| 23 | shared_memory->size = size; | 24 | shared_memory->size = size; |
| 24 | shared_memory->permissions = permissions; | 25 | shared_memory->permissions = permissions; |
| 25 | shared_memory->other_permissions = other_permissions; | 26 | shared_memory->other_permissions = other_permissions; |
| @@ -30,9 +31,31 @@ SharedPtr<SharedMemory> SharedMemory::Create(u32 size, MemoryPermission permissi | |||
| 30 | ResultCode SharedMemory::Map(VAddr address, MemoryPermission permissions, | 31 | ResultCode SharedMemory::Map(VAddr address, MemoryPermission permissions, |
| 31 | MemoryPermission other_permissions) { | 32 | MemoryPermission other_permissions) { |
| 32 | 33 | ||
| 34 | if (base_address != 0) { | ||
| 35 | LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s: already mapped at 0x%08X!", | ||
| 36 | GetObjectId(), address, name.c_str(), base_address); | ||
| 37 | // TODO: Verify error code with hardware | ||
| 38 | return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, | ||
| 39 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); | ||
| 40 | } | ||
| 41 | |||
| 42 | if (fixed_address != 0) { | ||
| 43 | if (address != 0 && address != fixed_address) { | ||
| 44 | LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s: fixed_addres is 0x%08X!", | ||
| 45 | GetObjectId(), address, name.c_str(), fixed_address); | ||
| 46 | // TODO: Verify error code with hardware | ||
| 47 | return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, | ||
| 48 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); | ||
| 49 | } | ||
| 50 | |||
| 51 | // HACK(yuriks): This is only here to support the APT shared font mapping right now. | ||
| 52 | // Later, this should actually map the memory block onto the address space. | ||
| 53 | return RESULT_SUCCESS; | ||
| 54 | } | ||
| 55 | |||
| 33 | if (address < Memory::SHARED_MEMORY_VADDR || address + size >= Memory::SHARED_MEMORY_VADDR_END) { | 56 | if (address < Memory::SHARED_MEMORY_VADDR || address + size >= Memory::SHARED_MEMORY_VADDR_END) { |
| 34 | LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X outside of shared mem bounds!", | 57 | LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s outside of shared mem bounds!", |
| 35 | GetObjectId(), address); | 58 | GetObjectId(), address, name.c_str()); |
| 36 | // TODO: Verify error code with hardware | 59 | // TODO: Verify error code with hardware |
| 37 | return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, | 60 | return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, |
| 38 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); | 61 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); |
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index 7a2922776..35b550d12 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h | |||
| @@ -61,6 +61,8 @@ public: | |||
| 61 | 61 | ||
| 62 | /// Address of shared memory block in the process. | 62 | /// Address of shared memory block in the process. |
| 63 | VAddr base_address; | 63 | VAddr base_address; |
| 64 | /// Fixed address to allow mapping to. Used for blocks created from the linear heap. | ||
| 65 | VAddr fixed_address; | ||
| 64 | /// Size of the memory block. Page-aligned. | 66 | /// Size of the memory block. Page-aligned. |
| 65 | u32 size; | 67 | u32 size; |
| 66 | /// Permission restrictions applied to the process which created the block. | 68 | /// Permission restrictions applied to the process which created the block. |