blob: 8b23638b8762542d087232aa384fff62eab23c21 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <memory>
#include "common/common_types.h"
namespace Tegra::Host1x {
class Host1x;
} // namespace Tegra::Host1x
namespace Service::Nvidia::NvCore {
class HeapMapper {
public:
HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, size_t smmu_id,
Tegra::Host1x::Host1x& host1x);
~HeapMapper();
bool IsInBounds(VAddr start, size_t size) const {
VAddr end = start + size;
return start >= m_vaddress && end <= (m_vaddress + m_size);
}
DAddr Map(VAddr start, size_t size);
void Unmap(VAddr start, size_t size);
DAddr GetRegionStart() const {
return m_daddress;
}
size_t GetRegionSize() const {
return m_size;
}
private:
struct HeapMapperInternal;
VAddr m_vaddress;
DAddr m_daddress;
size_t m_size;
size_t m_smmu_id;
std::unique_ptr<HeapMapperInternal> m_internal;
};
} // namespace Service::Nvidia::NvCore
|