summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/shared_memory.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-26 08:34:31 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-27 02:28:58 +0200
commit687d9739802097703a09f63d20ece741932b431b (patch)
tree68056642cf9eb09098a59e555570c9243a9a484d /src/core/hle/kernel/shared_memory.cpp
parentMerge pull request #1074 from lioncash/bool (diff)
downloadyuzu-687d9739802097703a09f63d20ece741932b431b.tar
yuzu-687d9739802097703a09f63d20ece741932b431b.tar.gz
yuzu-687d9739802097703a09f63d20ece741932b431b.tar.bz2
yuzu-687d9739802097703a09f63d20ece741932b431b.tar.lz
yuzu-687d9739802097703a09f63d20ece741932b431b.tar.xz
yuzu-687d9739802097703a09f63d20ece741932b431b.tar.zst
yuzu-687d9739802097703a09f63d20ece741932b431b.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/shared_memory.cpp27
1 files changed, 25 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
shared_memory->name = std::move(name);
shared_memory->base_address = 0x0;
+ shared_memory->fixed_address = 0x0;
shared_memory->size = size;
shared_memory->permissions = permissions;
shared_memory->other_permissions = other_permissions;
@@ -30,9 +31,31 @@ SharedPtr<SharedMemory> SharedMemory::Create(u32 size, MemoryPermission permissi
ResultCode SharedMemory::Map(VAddr address, MemoryPermission permissions,
MemoryPermission other_permissions) {
+ if (base_address != 0) {
+ LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s: already mapped at 0x%08X!",
+ GetObjectId(), address, name.c_str(), base_address);
+ // TODO: Verify error code with hardware
+ return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
+ ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
+ }
+
+ if (fixed_address != 0) {
+ if (address != 0 && address != fixed_address) {
+ LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s: fixed_addres is 0x%08X!",
+ GetObjectId(), address, name.c_str(), fixed_address);
+ // TODO: Verify error code with hardware
+ return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
+ ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
+ }
+
+ // HACK(yuriks): This is only here to support the APT shared font mapping right now.
+ // Later, this should actually map the memory block onto the address space.
+ return RESULT_SUCCESS;
+ }
+
if (address < Memory::SHARED_MEMORY_VADDR || address + size >= Memory::SHARED_MEMORY_VADDR_END) {
- LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X outside of shared mem bounds!",
- GetObjectId(), address);
+ LOG_ERROR(Kernel, "cannot map id=%u, address=0x%08X name=%s outside of shared mem bounds!",
+ GetObjectId(), address, name.c_str());
// TODO: Verify error code with hardware
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);