2026-09-09 21:35:49 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
2026-01-13 00:27:31 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-03-02 15:20:28 -05:00
|
|
|
|
|
|
|
|
#include "common/page_table.h"
|
2024-01-07 13:59:48 -05:00
|
|
|
#include "common/scope_exit.h"
|
2019-03-02 15:20:28 -05:00
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
|
|
2020-04-08 22:49:51 -04:00
|
|
|
PageTable::PageTable() = default;
|
2019-03-02 15:20:28 -05:00
|
|
|
|
2020-11-17 19:58:41 -05:00
|
|
|
PageTable::~PageTable() noexcept = default;
|
2019-03-02 15:20:28 -05:00
|
|
|
|
2026-09-09 21:35:49 +02:00
|
|
|
void PageTable::Resize(std::size_t address_space_width_in_bits, std::size_t page_bits) {
|
|
|
|
|
auto const num_page_table_entries = 1ULL << (address_space_width_in_bits - page_bits);
|
|
|
|
|
entries.ResizeAndClear(num_page_table_entries);
|
2021-05-29 09:24:09 +02:00
|
|
|
current_address_space_width_in_bits = address_space_width_in_bits;
|
2026-09-09 21:35:49 +02:00
|
|
|
current_page_bits = page_bits;
|
2019-03-02 15:20:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Common
|