summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2018-11-19 08:29:25 -0500
committerGravatar Lioncash2018-11-19 09:20:25 -0500
commitf4722327059b3a618ea63539a31c4f5a16e14bd4 (patch)
tree7a9fe4439de56a80c8fbc5a51f5a31199d92a1c6 /src
parentMerge pull request #1717 from FreddyFunk/swizzle-gob (diff)
downloadyuzu-f4722327059b3a618ea63539a31c4f5a16e14bd4.tar.gz
yuzu-f4722327059b3a618ea63539a31c4f5a16e14bd4.tar.xz
yuzu-f4722327059b3a618ea63539a31c4f5a16e14bd4.zip
kernel/shared_memory: Make data members private
Rather than allow unfettered access to the class internals, we hide all members by default and create and API that other code can operate against.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/shared_memory.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h
index 2c06bb7ce..9a7c189e8 100644
--- a/src/core/hle/kernel/shared_memory.h
+++ b/src/core/hle/kernel/shared_memory.h
@@ -81,6 +81,11 @@ public:
81 return HANDLE_TYPE; 81 return HANDLE_TYPE;
82 } 82 }
83 83
84 /// Gets the size of the underlying memory block in bytes.
85 u64 GetSize() const {
86 return size;
87 }
88
84 /** 89 /**
85 * Converts the specified MemoryPermission into the equivalent VMAPermission. 90 * Converts the specified MemoryPermission into the equivalent VMAPermission.
86 * @param permission The MemoryPermission to convert. 91 * @param permission The MemoryPermission to convert.
@@ -112,26 +117,26 @@ public:
112 */ 117 */
113 u8* GetPointer(u32 offset = 0); 118 u8* GetPointer(u32 offset = 0);
114 119
115 /// Process that created this shared memory block. 120private:
116 SharedPtr<Process> owner_process; 121 explicit SharedMemory(KernelCore& kernel);
117 /// Address of shared memory block in the owner process if specified. 122 ~SharedMemory() override;
118 VAddr base_address; 123
119 /// Backing memory for this shared memory block. 124 /// Backing memory for this shared memory block.
120 std::shared_ptr<std::vector<u8>> backing_block; 125 std::shared_ptr<std::vector<u8>> backing_block;
121 /// Offset into the backing block for this shared memory. 126 /// Offset into the backing block for this shared memory.
122 std::size_t backing_block_offset; 127 std::size_t backing_block_offset = 0;
123 /// Size of the memory block. Page-aligned. 128 /// Size of the memory block. Page-aligned.
124 u64 size; 129 u64 size = 0;
125 /// Permission restrictions applied to the process which created the block. 130 /// Permission restrictions applied to the process which created the block.
126 MemoryPermission permissions; 131 MemoryPermission permissions{};
127 /// Permission restrictions applied to other processes mapping the block. 132 /// Permission restrictions applied to other processes mapping the block.
128 MemoryPermission other_permissions; 133 MemoryPermission other_permissions{};
134 /// Process that created this shared memory block.
135 SharedPtr<Process> owner_process;
136 /// Address of shared memory block in the owner process if specified.
137 VAddr base_address = 0;
129 /// Name of shared memory object. 138 /// Name of shared memory object.
130 std::string name; 139 std::string name;
131
132private:
133 explicit SharedMemory(KernelCore& kernel);
134 ~SharedMemory() override;
135}; 140};
136 141
137} // namespace Kernel 142} // namespace Kernel