diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-10-23 05:20:01 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-11-24 20:08:36 +0100 |
commit | c2588403c0b8cf198f13f903f626851c7e94266c (patch) | |
tree | 09d26cdae187a47338caf94943291c60b4a40a4c /src/core/hle/kernel/shared_memory.cpp | |
parent | Change some SkyEye defines to const ints (diff) | |
download | yuzu-c2588403c0b8cf198f13f903f626851c7e94266c.tar yuzu-c2588403c0b8cf198f13f903f626851c7e94266c.tar.gz yuzu-c2588403c0b8cf198f13f903f626851c7e94266c.tar.bz2 yuzu-c2588403c0b8cf198f13f903f626851c7e94266c.tar.lz yuzu-c2588403c0b8cf198f13f903f626851c7e94266c.tar.xz yuzu-c2588403c0b8cf198f13f903f626851c7e94266c.tar.zst yuzu-c2588403c0b8cf198f13f903f626851c7e94266c.zip |
Diffstat (limited to 'src/core/hle/kernel/shared_memory.cpp')
-rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 7ef3e54cc..b91fc98da 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -21,10 +21,10 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) override { + ResultVal<bool> WaitSynchronization() override { // TODO(bunnei): ImplementMe ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); - return 0; + return UnimplementedFunction(ErrorModule::OS); } u32 base_address; ///< Address of shared memory block in RAM @@ -67,22 +67,23 @@ Handle CreateSharedMemory(const std::string& name) { * @param other_permissions Memory block map other permissions (specified by SVC field) * @return Result of operation, 0 on success, otherwise error code */ -Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, +ResultCode MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, MemoryPermission other_permissions) { if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) { ERROR_LOG(KERNEL, "cannot map handle=0x%08X, address=0x%08X outside of shared mem bounds!", handle, address); - return -1; + return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, + ErrorSummary::InvalidArgument, ErrorLevel::Permanent); } - SharedMemory* shared_memory = Kernel::g_object_pool.GetFast<SharedMemory>(handle); - _assert_msg_(KERNEL, (shared_memory != nullptr), "handle 0x%08X is not valid!", handle); + SharedMemory* shared_memory = Kernel::g_object_pool.Get<SharedMemory>(handle); + if (shared_memory == nullptr) return InvalidHandle(ErrorModule::Kernel); shared_memory->base_address = address; shared_memory->permissions = permissions; shared_memory->other_permissions = other_permissions; - return 0; + return RESULT_SUCCESS; } /** @@ -91,15 +92,17 @@ Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, * @param offset Offset from the start of the shared memory block to get pointer * @return Pointer to the shared memory block from the specified offset */ -u8* GetSharedMemoryPointer(Handle handle, u32 offset) { - SharedMemory* shared_memory = Kernel::g_object_pool.GetFast<SharedMemory>(handle); - _assert_msg_(KERNEL, (shared_memory != nullptr), "handle 0x%08X is not valid!", handle); +ResultVal<u8*> GetSharedMemoryPointer(Handle handle, u32 offset) { + SharedMemory* shared_memory = Kernel::g_object_pool.Get<SharedMemory>(handle); + if (shared_memory == nullptr) return InvalidHandle(ErrorModule::Kernel); if (0 != shared_memory->base_address) - return Memory::GetPointer(shared_memory->base_address + offset); + return MakeResult<u8*>(Memory::GetPointer(shared_memory->base_address + offset)); ERROR_LOG(KERNEL, "memory block handle=0x%08X not mapped!", handle); - return nullptr; + // TODO(yuriks): Verify error code. + return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, + ErrorSummary::InvalidState, ErrorLevel::Permanent); } } // namespace |