diff options
| author | 2021-03-19 23:52:47 -0700 | |
|---|---|---|
| committer | 2021-03-21 14:45:03 -0700 | |
| commit | 28be8aec9a4499206662a7bd74091706000e3d6d (patch) | |
| tree | d751a30ae95ae0f60a381eb1caa815ad552439be /src | |
| parent | hle: kernel: k_address_space_info: Cleanup. (diff) | |
| download | yuzu-28be8aec9a4499206662a7bd74091706000e3d6d.tar.gz yuzu-28be8aec9a4499206662a7bd74091706000e3d6d.tar.xz yuzu-28be8aec9a4499206662a7bd74091706000e3d6d.zip | |
common: Move common sizes to their own header for code reuse.
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/common/common_sizes.h | 23 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_address_space_info.cpp | 14 |
3 files changed, 25 insertions, 13 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 788516ded..7253c0f4d 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -109,6 +109,7 @@ add_library(common STATIC | |||
| 109 | cityhash.h | 109 | cityhash.h |
| 110 | common_funcs.h | 110 | common_funcs.h |
| 111 | common_paths.h | 111 | common_paths.h |
| 112 | common_sizes.h | ||
| 112 | common_types.h | 113 | common_types.h |
| 113 | concepts.h | 114 | concepts.h |
| 114 | div_ceil.h | 115 | div_ceil.h |
diff --git a/src/common/common_sizes.h b/src/common/common_sizes.h new file mode 100644 index 000000000..26425a57d --- /dev/null +++ b/src/common/common_sizes.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | enum : u64 { | ||
| 10 | Size_1_MB = 0x100000ULL, | ||
| 11 | Size_2_MB = 2ULL * Size_1_MB, | ||
| 12 | Size_4_MB = 4ULL * Size_1_MB, | ||
| 13 | Size_14_MB = 14ULL * Size_1_MB, | ||
| 14 | Size_32_MB = 32ULL * Size_1_MB, | ||
| 15 | Size_128_MB = 128ULL * Size_1_MB, | ||
| 16 | Size_1_GB = 0x40000000ULL, | ||
| 17 | Size_2_GB = 2ULL * Size_1_GB, | ||
| 18 | Size_4_GB = 4ULL * Size_1_GB, | ||
| 19 | Size_6_GB = 6ULL * Size_1_GB, | ||
| 20 | Size_64_GB = 64ULL * Size_1_GB, | ||
| 21 | Size_512_GB = 512ULL * Size_1_GB, | ||
| 22 | Invalid = std::numeric_limits<u64>::max(), | ||
| 23 | }; | ||
diff --git a/src/core/hle/kernel/k_address_space_info.cpp b/src/core/hle/kernel/k_address_space_info.cpp index e9f56fbed..eb8af660c 100644 --- a/src/core/hle/kernel/k_address_space_info.cpp +++ b/src/core/hle/kernel/k_address_space_info.cpp | |||
| @@ -5,25 +5,13 @@ | |||
| 5 | #include <array> | 5 | #include <array> |
| 6 | 6 | ||
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/common_sizes.h" | ||
| 8 | #include "core/hle/kernel/k_address_space_info.h" | 9 | #include "core/hle/kernel/k_address_space_info.h" |
| 9 | 10 | ||
| 10 | namespace Kernel { | 11 | namespace Kernel { |
| 11 | 12 | ||
| 12 | namespace { | 13 | namespace { |
| 13 | 14 | ||
| 14 | enum : u64 { | ||
| 15 | Size_1_MB = 0x100000ULL, | ||
| 16 | Size_2_MB = 2ULL * Size_1_MB, | ||
| 17 | Size_128_MB = 128ULL * Size_1_MB, | ||
| 18 | Size_1_GB = 0x40000000ULL, | ||
| 19 | Size_2_GB = 2ULL * Size_1_GB, | ||
| 20 | Size_4_GB = 4ULL * Size_1_GB, | ||
| 21 | Size_6_GB = 6ULL * Size_1_GB, | ||
| 22 | Size_64_GB = 64ULL * Size_1_GB, | ||
| 23 | Size_512_GB = 512ULL * Size_1_GB, | ||
| 24 | Invalid = std::numeric_limits<u64>::max(), | ||
| 25 | }; | ||
| 26 | |||
| 27 | // clang-format off | 15 | // clang-format off |
| 28 | constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{ | 16 | constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{ |
| 29 | { .bit_width = 32, .address = Size_2_MB , .size = Size_1_GB - Size_2_MB , .type = KAddressSpaceInfo::Type::MapSmall, }, | 17 | { .bit_width = 32, .address = Size_2_MB , .size = Size_1_GB - Size_2_MB , .type = KAddressSpaceInfo::Type::MapSmall, }, |