common: common_sizes: Move Invalid to Size_* prefix and add missing values.
This commit is contained in:
parent
80688362cf
commit
8d0ba7ee49
|
@ -4,12 +4,18 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
enum : u64 {
|
enum : u64 {
|
||||||
|
Size_1_KB = 0x400ULL,
|
||||||
|
Size_64_KB = 64ULL * Size_1_KB,
|
||||||
|
Size_128_KB = 128ULL * Size_1_KB,
|
||||||
Size_1_MB = 0x100000ULL,
|
Size_1_MB = 0x100000ULL,
|
||||||
Size_2_MB = 2ULL * Size_1_MB,
|
Size_2_MB = 2ULL * Size_1_MB,
|
||||||
Size_4_MB = 4ULL * Size_1_MB,
|
Size_4_MB = 4ULL * Size_1_MB,
|
||||||
|
Size_5_MB = 5ULL * Size_1_MB,
|
||||||
Size_14_MB = 14ULL * Size_1_MB,
|
Size_14_MB = 14ULL * Size_1_MB,
|
||||||
Size_32_MB = 32ULL * Size_1_MB,
|
Size_32_MB = 32ULL * Size_1_MB,
|
||||||
Size_33_MB = 33ULL * Size_1_MB,
|
Size_33_MB = 33ULL * Size_1_MB,
|
||||||
|
@ -29,5 +35,5 @@ enum : u64 {
|
||||||
Size_8_GB = 8ULL * Size_1_GB,
|
Size_8_GB = 8ULL * Size_1_GB,
|
||||||
Size_64_GB = 64ULL * Size_1_GB,
|
Size_64_GB = 64ULL * Size_1_GB,
|
||||||
Size_512_GB = 512ULL * Size_1_GB,
|
Size_512_GB = 512ULL * Size_1_GB,
|
||||||
Invalid = std::numeric_limits<u64>::max(),
|
Size_Invalid = std::numeric_limits<u64>::max(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,22 +16,22 @@ namespace {
|
||||||
constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
|
constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
|
||||||
{ .bit_width = 32, .address = Size_2_MB , .size = Size_1_GB - Size_2_MB , .type = KAddressSpaceInfo::Type::MapSmall, },
|
{ .bit_width = 32, .address = Size_2_MB , .size = Size_1_GB - Size_2_MB , .type = KAddressSpaceInfo::Type::MapSmall, },
|
||||||
{ .bit_width = 32, .address = Size_1_GB , .size = Size_4_GB - Size_1_GB , .type = KAddressSpaceInfo::Type::MapLarge, },
|
{ .bit_width = 32, .address = Size_1_GB , .size = Size_4_GB - Size_1_GB , .type = KAddressSpaceInfo::Type::MapLarge, },
|
||||||
{ .bit_width = 32, .address = Invalid , .size = Size_1_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
{ .bit_width = 32, .address = Size_Invalid, .size = Size_1_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
||||||
{ .bit_width = 32, .address = Invalid , .size = Size_1_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
{ .bit_width = 32, .address = Size_Invalid, .size = Size_1_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
||||||
{ .bit_width = 36, .address = Size_128_MB, .size = Size_2_GB - Size_128_MB, .type = KAddressSpaceInfo::Type::MapSmall, },
|
{ .bit_width = 36, .address = Size_128_MB , .size = Size_2_GB - Size_128_MB, .type = KAddressSpaceInfo::Type::MapSmall, },
|
||||||
{ .bit_width = 36, .address = Size_2_GB , .size = Size_64_GB - Size_2_GB , .type = KAddressSpaceInfo::Type::MapLarge, },
|
{ .bit_width = 36, .address = Size_2_GB , .size = Size_64_GB - Size_2_GB , .type = KAddressSpaceInfo::Type::MapLarge, },
|
||||||
{ .bit_width = 36, .address = Invalid , .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
{ .bit_width = 36, .address = Size_Invalid, .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
||||||
{ .bit_width = 36, .address = Invalid , .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
{ .bit_width = 36, .address = Size_Invalid, .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
||||||
{ .bit_width = 39, .address = Size_128_MB, .size = Size_512_GB - Size_128_MB, .type = KAddressSpaceInfo::Type::Map39Bit, },
|
{ .bit_width = 39, .address = Size_128_MB , .size = Size_512_GB - Size_128_MB, .type = KAddressSpaceInfo::Type::Map39Bit, },
|
||||||
{ .bit_width = 39, .address = Invalid , .size = Size_64_GB , .type = KAddressSpaceInfo::Type::MapSmall },
|
{ .bit_width = 39, .address = Size_Invalid, .size = Size_64_GB , .type = KAddressSpaceInfo::Type::MapSmall },
|
||||||
{ .bit_width = 39, .address = Invalid , .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
{ .bit_width = 39, .address = Size_Invalid, .size = Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
||||||
{ .bit_width = 39, .address = Invalid , .size = Size_64_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
{ .bit_width = 39, .address = Size_Invalid, .size = Size_64_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
||||||
{ .bit_width = 39, .address = Invalid , .size = Size_2_GB , .type = KAddressSpaceInfo::Type::Stack, },
|
{ .bit_width = 39, .address = Size_Invalid, .size = Size_2_GB , .type = KAddressSpaceInfo::Type::Stack, },
|
||||||
}};
|
}};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
constexpr bool IsAllowedIndexForAddress(std::size_t index) {
|
constexpr bool IsAllowedIndexForAddress(std::size_t index) {
|
||||||
return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Invalid;
|
return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Size_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
using IndexArray =
|
using IndexArray =
|
||||||
|
|
Reference in New Issue