diff options
author | Lioncash <mathew1800@gmail.com> | 2018-10-18 18:55:27 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-10-18 18:57:02 +0200 |
commit | d27f4a4928f493f9e7a2987ad93e6be918b70f6c (patch) | |
tree | 9b5c2faf236744707520c788dc4cdfde68c7e045 /src/core/hle | |
parent | Merge pull request #1510 from lioncash/xci (diff) | |
download | yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.tar yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.tar.gz yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.tar.bz2 yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.tar.lz yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.tar.xz yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.tar.zst yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.zip |
Diffstat (limited to 'src/core/hle')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index d08b84bde..b0bdd822e 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -8,6 +8,7 @@ #include <mutex> #include <vector> +#include "common/alignment.h" #include "common/assert.h" #include "common/logging/log.h" #include "common/microprofile.h" @@ -36,9 +37,6 @@ namespace Kernel { namespace { -constexpr bool Is4KBAligned(VAddr address) { - return (address & 0xFFF) == 0; -} // Checks if address + size is greater than the given address // This can return false if the size causes an overflow of a 64-bit type @@ -69,11 +67,11 @@ bool IsInsideNewMapRegion(const VMManager& vm, VAddr address, u64 size) { // in the same order. ResultCode MapUnmapMemorySanityChecks(const VMManager& vm_manager, VAddr dst_addr, VAddr src_addr, u64 size) { - if (!Is4KBAligned(dst_addr) || !Is4KBAligned(src_addr)) { + if (!Common::Is4KBAligned(dst_addr) || !Common::Is4KBAligned(src_addr)) { return ERR_INVALID_ADDRESS; } - if (size == 0 || !Is4KBAligned(size)) { + if (size == 0 || !Common::Is4KBAligned(size)) { return ERR_INVALID_SIZE; } @@ -570,11 +568,11 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", shared_memory_handle, addr, size, permissions); - if (!Is4KBAligned(addr)) { + if (!Common::Is4KBAligned(addr)) { return ERR_INVALID_ADDRESS; } - if (size == 0 || !Is4KBAligned(size)) { + if (size == 0 || !Common::Is4KBAligned(size)) { return ERR_INVALID_SIZE; } @@ -599,11 +597,11 @@ static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 LOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}", shared_memory_handle, addr, size); - if (!Is4KBAligned(addr)) { + if (!Common::Is4KBAligned(addr)) { return ERR_INVALID_ADDRESS; } - if (size == 0 || !Is4KBAligned(size)) { + if (size == 0 || !Common::Is4KBAligned(size)) { return ERR_INVALID_SIZE; } |