diff options
| author | 2021-03-20 00:43:00 -0700 | |
|---|---|---|
| committer | 2021-03-21 14:45:03 -0700 | |
| commit | 8d0ba7ee494af17c85ef2d617db5f2a7acaa37cf (patch) | |
| tree | 51890f6a5accc88ebbde67d32ce0c4cecd30b10b /src | |
| parent | hle: kernel: k_memory_region: Refactor to simplify code. (diff) | |
| download | yuzu-8d0ba7ee494af17c85ef2d617db5f2a7acaa37cf.tar.gz yuzu-8d0ba7ee494af17c85ef2d617db5f2a7acaa37cf.tar.xz yuzu-8d0ba7ee494af17c85ef2d617db5f2a7acaa37cf.zip | |
common: common_sizes: Move Invalid to Size_* prefix and add missing values.
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/common_sizes.h | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_address_space_info.cpp | 28 |
2 files changed, 21 insertions, 15 deletions
diff --git a/src/common/common_sizes.h b/src/common/common_sizes.h index a6500bddd..5dc039c94 100644 --- a/src/common/common_sizes.h +++ b/src/common/common_sizes.h | |||
| @@ -4,12 +4,18 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <limits> | ||
| 8 | |||
| 7 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 8 | 10 | ||
| 9 | enum : u64 { | 11 | enum : u64 { |
| 12 | Size_1_KB = 0x400ULL, | ||
| 13 | Size_64_KB = 64ULL * Size_1_KB, | ||
| 14 | Size_128_KB = 128ULL * Size_1_KB, | ||
| 10 | Size_1_MB = 0x100000ULL, | 15 | Size_1_MB = 0x100000ULL, |
| 11 | Size_2_MB = 2ULL * Size_1_MB, | 16 | Size_2_MB = 2ULL * Size_1_MB, |
| 12 | Size_4_MB = 4ULL * Size_1_MB, | 17 | Size_4_MB = 4ULL * Size_1_MB, |
| 18 | Size_5_MB = 5ULL * Size_1_MB, | ||
| 13 | Size_14_MB = 14ULL * Size_1_MB, | 19 | Size_14_MB = 14ULL * Size_1_MB, |
| 14 | Size_32_MB = 32ULL * Size_1_MB, | 20 | Size_32_MB = 32ULL * Size_1_MB, |
| 15 | Size_33_MB = 33ULL * Size_1_MB, | 21 | Size_33_MB = 33ULL * Size_1_MB, |
| @@ -29,5 +35,5 @@ enum : u64 { | |||
| 29 | Size_8_GB = 8ULL * Size_1_GB, | 35 | Size_8_GB = 8ULL * Size_1_GB, |
| 30 | Size_64_GB = 64ULL * Size_1_GB, | 36 | Size_64_GB = 64ULL * Size_1_GB, |
| 31 | Size_512_GB = 512ULL * Size_1_GB, | 37 | Size_512_GB = 512ULL * Size_1_GB, |
| 32 | Invalid = std::numeric_limits<u64>::max(), | 38 | Size_Invalid = std::numeric_limits<u64>::max(), |
| 33 | }; | 39 | }; |
diff --git a/src/core/hle/kernel/k_address_space_info.cpp b/src/core/hle/kernel/k_address_space_info.cpp index eb8af660c..89906954d 100644 --- a/src/core/hle/kernel/k_address_space_info.cpp +++ b/src/core/hle/kernel/k_address_space_info.cpp | |||
| @@ -14,24 +14,24 @@ namespace { | |||
| 14 | 14 | ||
| 15 | // clang-format off | 15 | // clang-format off |
| 16 | constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{ | 16 | constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{ |
| 17 | { .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, }, |
| 18 | { .bit_width = 32, .address = Size_1_GB , .size = Size_4_GB - Size_1_GB , .type = KAddressSpaceInfo::Type::MapLarge, }, | 18 | { .bit_width = 32, .address = Size_1_GB , .size = Size_4_GB - Size_1_GB , .type = KAddressSpaceInfo::Type::MapLarge, }, |
| 19 | { .bit_width = 32, .address = Invalid , .size = Size_1_GB , .type = KAddressSpaceInfo::Type::Heap, }, | 19 | { .bit_width = 32, .address = Size_Invalid, .size = Size_1_GB , .type = KAddressSpaceInfo::Type::Heap, }, |
| 20 | { .bit_width = 32, .address = Invalid , .size = Size_1_GB , .type = KAddressSpaceInfo::Type::Alias, }, | 20 | { .bit_width = 32, .address = Size_Invalid, .size = Size_1_GB , .type = KAddressSpaceInfo::Type::Alias, }, |
| 21 | { .bit_width = 36, .address = Size_128_MB, .size = Size_2_GB - Size_128_MB, .type = KAddressSpaceInfo::Type::MapSmall, }, | 21 | { .bit_width = 36, .address = Size_128_MB , .size = Size_2_GB - Size_128_MB, .type = KAddressSpaceInfo::Type::MapSmall, }, |
| 22 | { .bit_width = 36, .address = Size_2_GB , .size = Size_64_GB - Size_2_GB , .type = KAddressSpaceInfo::Type::MapLarge, }, | 22 | { .bit_width = 36, .address = Size_2_GB , .size = Size_64_GB - Size_2_GB , .type = KAddressSpaceInfo::Type::MapLarge, }, |
| 23 | { .bit_width = 36, .address = Invalid , .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, }, | 23 | { .bit_width = 36, .address = Size_Invalid, .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, }, |
| 24 | { .bit_width = 36, .address = Invalid , .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Alias, }, | 24 | { .bit_width = 36, .address = Size_Invalid, .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Alias, }, |
| 25 | { .bit_width = 39, .address = Size_128_MB, .size = Size_512_GB - Size_128_MB, .type = KAddressSpaceInfo::Type::Map39Bit, }, | 25 | { .bit_width = 39, .address = Size_128_MB , .size = Size_512_GB - Size_128_MB, .type = KAddressSpaceInfo::Type::Map39Bit, }, |
| 26 | { .bit_width = 39, .address = Invalid , .size = Size_64_GB , .type = KAddressSpaceInfo::Type::MapSmall }, | 26 | { .bit_width = 39, .address = Size_Invalid, .size = Size_64_GB , .type = KAddressSpaceInfo::Type::MapSmall }, |
| 27 | { .bit_width = 39, .address = Invalid , .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, }, | 27 | { .bit_width = 39, .address = Size_Invalid, .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, }, |
| 28 | { .bit_width = 39, .address = Invalid , .size = Size_64_GB , .type = KAddressSpaceInfo::Type::Alias, }, | 28 | { .bit_width = 39, .address = Size_Invalid, .size = Size_64_GB , .type = KAddressSpaceInfo::Type::Alias, }, |
| 29 | { .bit_width = 39, .address = Invalid , .size = Size_2_GB , .type = KAddressSpaceInfo::Type::Stack, }, | 29 | { .bit_width = 39, .address = Size_Invalid, .size = Size_2_GB , .type = KAddressSpaceInfo::Type::Stack, }, |
| 30 | }}; | 30 | }}; |
| 31 | // clang-format on | 31 | // clang-format on |
| 32 | 32 | ||
| 33 | constexpr bool IsAllowedIndexForAddress(std::size_t index) { | 33 | constexpr bool IsAllowedIndexForAddress(std::size_t index) { |
| 34 | return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Invalid; | 34 | return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Size_Invalid; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | using IndexArray = | 37 | using IndexArray = |