summaryrefslogtreecommitdiffstats
path: root/src/core/device_memory.cpp
blob: 61429a6acfa53d06fd09f1d1c58eeb2d624af8b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 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 {

DeviceMemory::DeviceMemory(System& system) : buffer{DramMemoryMap::Size}, system{system} {}

DeviceMemory::~DeviceMemory() = default;

PAddr DeviceMemory::GetPhysicalAddr(VAddr addr) {
    const u8* const base{system.Memory().GetPointer(addr)};
    ASSERT(base);
    const uintptr_t offset{static_cast<uintptr_t>(base - GetPointer(DramMemoryMap::Base))};
    return DramMemoryMap::Base + offset;
}

} // namespace Core