This repository has been archived on 2024-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
2020-04-03 02:00:41 +00: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 21:39:58 +00:00
|
|
|
DeviceMemory::DeviceMemory(System& system) : buffer{DramMemoryMap::Size}, system{system} {}
|
2020-04-03 02:00:41 +00:00
|
|
|
|
2020-04-08 21:39:58 +00:00
|
|
|
DeviceMemory::~DeviceMemory() = default;
|
2020-04-03 02:00:41 +00:00
|
|
|
|
|
|
|
PAddr DeviceMemory::GetPhysicalAddr(VAddr addr) {
|
2020-04-08 21:39:58 +00: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 02:00:41 +00:00
|
|
|
return DramMemoryMap::Base + offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Core
|