yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

core: device_memory: Use memory size reported by KSystemControl.

- That way, we can consolidate the memory layout to one place.
This commit is contained in:
bunnei 2022-02-21 12:36:34 -08:00
parent 70482e6b26
commit c0e45a3c78
3 changed files with 5 additions and 7 deletions

View File

@ -3,10 +3,13 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/device_memory.h" #include "core/device_memory.h"
#include "hle/kernel/board/nintendo/nx/k_system_control.h"
namespace Core { namespace Core {
DeviceMemory::DeviceMemory() : buffer{DramMemoryMap::Size, 1ULL << 39} {} DeviceMemory::DeviceMemory()
: buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(),
1ULL << 39} {}
DeviceMemory::~DeviceMemory() = default; DeviceMemory::~DeviceMemory() = default;
} // namespace Core } // namespace Core

View File

@ -12,12 +12,8 @@ namespace Core {
namespace DramMemoryMap { namespace DramMemoryMap {
enum : u64 { enum : u64 {
Base = 0x80000000ULL, Base = 0x80000000ULL,
Size = 0x100000000ULL,
End = Base + Size,
KernelReserveBase = Base + 0x60000, KernelReserveBase = Base + 0x60000,
SlabHeapBase = KernelReserveBase + 0x85000, SlabHeapBase = KernelReserveBase + 0x85000,
SlapHeapSize = 0xa21000,
SlabHeapEnd = SlabHeapBase + SlapHeapSize,
}; };
}; // namespace DramMemoryMap }; // namespace DramMemoryMap

View File

@ -39,8 +39,7 @@ struct Memory::Impl {
void MapMemoryRegion(Common::PageTable& page_table, VAddr base, u64 size, PAddr target) { void MapMemoryRegion(Common::PageTable& page_table, VAddr base, u64 size, PAddr target) {
ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size); ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size);
ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base); ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base);
ASSERT_MSG(target >= DramMemoryMap::Base && target < DramMemoryMap::End, ASSERT_MSG(target >= DramMemoryMap::Base, "Out of bounds target: {:016X}", target);
"Out of bounds target: {:016X}", target);
MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, Common::PageType::Memory); MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, Common::PageType::Memory);
if (Settings::IsFastmemEnabled()) { if (Settings::IsFastmemEnabled()) {