summaryrefslogtreecommitdiff
path: root/src/common/host_memory.h
diff options
context:
space:
mode:
authorGravatar liamwhite2023-11-30 09:20:55 -0500
committerGravatar GitHub2023-11-30 09:20:55 -0500
commit57a391e71db13ade7a3d96f59d53781eff18d2ac (patch)
tree0b4223de40a2d77598ac9095b1374353c2e9da7c /src/common/host_memory.h
parentMerge pull request #12223 from liamwhite/fruit-company (diff)
parentcore: Rename patcher file (diff)
downloadyuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.gz
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.xz
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.zip
Merge pull request #12074 from GPUCode/yuwu-on-the-metal
Implement Native Code Execution (NCE)
Diffstat (limited to 'src/common/host_memory.h')
-rw-r--r--src/common/host_memory.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/common/host_memory.h b/src/common/host_memory.h
index 447975ded..cebfacab2 100644
--- a/src/common/host_memory.h
+++ b/src/common/host_memory.h
@@ -4,11 +4,20 @@
4#pragma once 4#pragma once
5 5
6#include <memory> 6#include <memory>
7#include "common/common_funcs.h"
7#include "common/common_types.h" 8#include "common/common_types.h"
8#include "common/virtual_buffer.h" 9#include "common/virtual_buffer.h"
9 10
10namespace Common { 11namespace Common {
11 12
13enum class MemoryPermission : u32 {
14 Read = 1 << 0,
15 Write = 1 << 1,
16 ReadWrite = Read | Write,
17 Execute = 1 << 2,
18};
19DECLARE_ENUM_FLAG_OPERATORS(MemoryPermission)
20
12/** 21/**
13 * A low level linear memory buffer, which supports multiple mappings 22 * A low level linear memory buffer, which supports multiple mappings
14 * Its purpose is to rebuild a given sparse memory layout, including mirrors. 23 * Its purpose is to rebuild a given sparse memory layout, including mirrors.
@@ -31,11 +40,13 @@ public:
31 HostMemory(HostMemory&& other) noexcept; 40 HostMemory(HostMemory&& other) noexcept;
32 HostMemory& operator=(HostMemory&& other) noexcept; 41 HostMemory& operator=(HostMemory&& other) noexcept;
33 42
34 void Map(size_t virtual_offset, size_t host_offset, size_t length); 43 void Map(size_t virtual_offset, size_t host_offset, size_t length, MemoryPermission perms);
35 44
36 void Unmap(size_t virtual_offset, size_t length); 45 void Unmap(size_t virtual_offset, size_t length);
37 46
38 void Protect(size_t virtual_offset, size_t length, bool read, bool write); 47 void Protect(size_t virtual_offset, size_t length, bool read, bool write, bool execute = false);
48
49 void EnableDirectMappedAddress();
39 50
40 [[nodiscard]] u8* BackingBasePointer() noexcept { 51 [[nodiscard]] u8* BackingBasePointer() noexcept {
41 return backing_base; 52 return backing_base;