Introduce page size constants and replace all usages of PAGE_SIZE

Avoids using macros and results in code which looks slightly cleaner.
This commit is contained in:
Billy Laws
2022-08-31 13:08:28 +01:00
parent 30ec844a1b
commit 6359852652
11 changed files with 30 additions and 26 deletions

View File

@ -16,10 +16,8 @@ namespace skyline::gpu {
std::mutex mutex; //!< Synchronizes access to the buffer mappings
std::vector<std::shared_ptr<Buffer>> bufferMappings; //!< A sorted vector of all buffer mappings
static constexpr size_t AddressSpaceSize{1ULL << 39}; //!< The size of the guest CPU AS in bytes
static constexpr size_t PageSizeBits{12}; //!< The size of a single page of the guest CPU AS as a power of two (4 KiB == 1 << 12)
static constexpr size_t L2EntryGranularity{19}; //!< The amount of AS (in bytes) a single L2 PTE covers (512 KiB == 1 << 19)
SegmentTable<Buffer*, AddressSpaceSize, PageSizeBits, L2EntryGranularity> bufferTable; //!< A page table of all buffer mappings for O(1) lookups on full matches
SegmentTable<Buffer *, constant::AddressSpaceSize, constant::PageSizeBits, L2EntryGranularity> bufferTable; //!< A page table of all buffer mappings for O(1) lookups on full matches
/**
* @brief A wrapper around a Buffer which locks it with the specified ContextTag