diff options
| author | 2021-04-02 17:06:21 -0700 | |
|---|---|---|
| committer | 2021-05-05 16:40:50 -0700 | |
| commit | 340167676828bf4595bc267c927f156a11b288aa (patch) | |
| tree | a8af50757dcea3878ae928d491f4108d392e29aa /src/core/memory.h | |
| parent | common: common_funcs: Add Size helper function. (diff) | |
| download | yuzu-340167676828bf4595bc267c927f156a11b288aa.tar.gz yuzu-340167676828bf4595bc267c927f156a11b288aa.tar.xz yuzu-340167676828bf4595bc267c927f156a11b288aa.zip | |
core: memory: Add a work-around to allocate and access kernel memory regions by vaddr.
Diffstat (limited to 'src/core/memory.h')
| -rw-r--r-- | src/core/memory.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/memory.h b/src/core/memory.h index 6d34fcfe2..9a706a9ac 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -59,6 +59,11 @@ public: | |||
| 59 | Memory& operator=(Memory&&) = default; | 59 | Memory& operator=(Memory&&) = default; |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| 62 | * Resets the state of the Memory system. | ||
| 63 | */ | ||
| 64 | void Reset(); | ||
| 65 | |||
| 66 | /** | ||
| 62 | * Changes the currently active page table to that of the given process instance. | 67 | * Changes the currently active page table to that of the given process instance. |
| 63 | * | 68 | * |
| 64 | * @param process The process to use the page table of. | 69 | * @param process The process to use the page table of. |
| @@ -116,6 +121,15 @@ public: | |||
| 116 | */ | 121 | */ |
| 117 | u8* GetPointer(VAddr vaddr); | 122 | u8* GetPointer(VAddr vaddr); |
| 118 | 123 | ||
| 124 | /** | ||
| 125 | * Gets a pointer to the start of a kernel heap allocated memory region. Will allocate one if it | ||
| 126 | * does not already exist. | ||
| 127 | * | ||
| 128 | * @param start_vaddr Start virtual address for the memory region. | ||
| 129 | * @param size Size of the memory region. | ||
| 130 | */ | ||
| 131 | u8* GetKernelBuffer(VAddr start_vaddr, size_t size); | ||
| 132 | |||
| 119 | template <typename T> | 133 | template <typename T> |
| 120 | T* GetPointer(VAddr vaddr) { | 134 | T* GetPointer(VAddr vaddr) { |
| 121 | return reinterpret_cast<T*>(GetPointer(vaddr)); | 135 | return reinterpret_cast<T*>(GetPointer(vaddr)); |
| @@ -524,6 +538,8 @@ public: | |||
| 524 | void RasterizerMarkRegionCached(VAddr vaddr, u64 size, bool cached); | 538 | void RasterizerMarkRegionCached(VAddr vaddr, u64 size, bool cached); |
| 525 | 539 | ||
| 526 | private: | 540 | private: |
| 541 | Core::System& system; | ||
| 542 | |||
| 527 | struct Impl; | 543 | struct Impl; |
| 528 | std::unique_ptr<Impl> impl; | 544 | std::unique_ptr<Impl> impl; |
| 529 | }; | 545 | }; |