2020-04-03 04:00:41 +02:00
|
|
|
// Copyright 2020 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "core/core.h"
|
|
|
|
#include "core/device_memory.h"
|
|
|
|
#include "core/memory.h"
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
2020-04-08 23:39:58 +02:00
|
|
|
DeviceMemory::DeviceMemory(System& system) : buffer{DramMemoryMap::Size}, system{system} {}
|
2020-04-03 04:00:41 +02:00
|
|
|
|
2020-04-08 23:39:58 +02:00
|
|
|
DeviceMemory::~DeviceMemory() = default;
|
2020-04-03 04:00:41 +02:00
|
|
|
|
|
|
|
PAddr DeviceMemory::GetPhysicalAddr(VAddr addr) {
|
2020-04-08 23:39:58 +02:00
|
|
|
const u8* const base{system.Memory().GetPointer(addr)};
|
|
|
|
ASSERT(base);
|
|
|
|
const uintptr_t offset{static_cast<uintptr_t>(base - GetPointer(DramMemoryMap::Base))};
|
2020-04-03 04:00:41 +02:00
|
|
|
return DramMemoryMap::Base + offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Core
|