summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.h
diff options
context:
space:
mode:
authorGravatar Lioncash2018-09-29 18:47:00 -0400
committerGravatar Lioncash2018-09-30 02:30:01 -0400
commitcf9d6c6f526fffb2bf414ff774c5d0281a73ecf4 (patch)
treea9e0bbc02013f0dbc6409af9c8685a8b8b9e9f32 /src/core/hle/kernel/process.h
parentarm_interface: Add missing fpsr/tpidr members to the ThreadContext struct (diff)
downloadyuzu-cf9d6c6f526fffb2bf414ff774c5d0281a73ecf4.tar.gz
yuzu-cf9d6c6f526fffb2bf414ff774c5d0281a73ecf4.tar.xz
yuzu-cf9d6c6f526fffb2bf414ff774c5d0281a73ecf4.zip
kernel/process: Make data member variables private
Makes the public interface consistent in terms of how accesses are done on a process object. It also makes it slightly nicer to reason about the logic of the process class, as we don't want to expose everything to external code.
Diffstat (limited to 'src/core/hle/kernel/process.h')
-rw-r--r--src/core/hle/kernel/process.h97
1 files changed, 71 insertions, 26 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index adb03c228..2dfb88fa9 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -135,6 +135,16 @@ public:
135 return HANDLE_TYPE; 135 return HANDLE_TYPE;
136 } 136 }
137 137
138 /// Gets a reference to the process' memory manager.
139 Kernel::VMManager& VMManager() {
140 return vm_manager;
141 }
142
143 /// Gets a const reference to the process' memory manager.
144 const Kernel::VMManager& VMManager() const {
145 return vm_manager;
146 }
147
138 /// Gets the current status of the process 148 /// Gets the current status of the process
139 ProcessStatus GetStatus() const { 149 ProcessStatus GetStatus() const {
140 return status; 150 return status;
@@ -145,6 +155,40 @@ public:
145 return process_id; 155 return process_id;
146 } 156 }
147 157
158 /// Gets the title ID corresponding to this process.
159 u64 GetTitleID() const {
160 return program_id;
161 }
162
163 /// Gets the resource limit descriptor for this process
164 ResourceLimit& GetResourceLimit() {
165 return *resource_limit;
166 }
167
168 /// Gets the resource limit descriptor for this process
169 const ResourceLimit& GetResourceLimit() const {
170 return *resource_limit;
171 }
172
173 /// Gets the default CPU ID for this process
174 u8 GetDefaultProcessorID() const {
175 return ideal_processor;
176 }
177
178 /// Gets the bitmask of allowed CPUs that this process' threads can run on.
179 u32 GetAllowedProcessorMask() const {
180 return allowed_processor_mask;
181 }
182
183 /// Gets the bitmask of allowed thread priorities.
184 u32 GetAllowedThreadPriorityMask() const {
185 return allowed_thread_priority_mask;
186 }
187
188 u32 IsVirtualMemoryEnabled() const {
189 return is_virtual_address_memory_enabled;
190 }
191
148 /** 192 /**
149 * Loads process-specifics configuration info with metadata provided 193 * Loads process-specifics configuration info with metadata provided
150 * by an executable. 194 * by an executable.
@@ -153,30 +197,6 @@ public:
153 */ 197 */
154 void LoadFromMetadata(const FileSys::ProgramMetadata& metadata); 198 void LoadFromMetadata(const FileSys::ProgramMetadata& metadata);
155 199
156 /// Title ID corresponding to the process
157 u64 program_id;
158
159 /// Resource limit descriptor for this process
160 SharedPtr<ResourceLimit> resource_limit;
161
162 /// The process may only call SVCs which have the corresponding bit set.
163 std::bitset<0x80> svc_access_mask;
164 /// Maximum size of the handle table for the process.
165 unsigned int handle_table_size = 0x200;
166 /// Special memory ranges mapped into this processes address space. This is used to give
167 /// processes access to specific I/O regions and device memory.
168 boost::container::static_vector<AddressMapping, 8> address_mappings;
169 ProcessFlags flags;
170 /// Kernel compatibility version for this process
171 u16 kernel_version = 0;
172 /// The default CPU for this process, threads are scheduled on this cpu by default.
173 u8 ideal_processor = 0;
174 /// Bitmask of allowed CPUs that this process' threads can run on. TODO(Subv): Actually parse
175 /// this value from the process header.
176 u32 allowed_processor_mask = THREADPROCESSORID_DEFAULT_MASK;
177 u32 allowed_thread_priority_mask = 0xFFFFFFFF;
178 u32 is_virtual_address_memory_enabled = 0;
179
180 /** 200 /**
181 * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them 201 * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them
182 * to this process. 202 * to this process.
@@ -212,18 +232,43 @@ public:
212 232
213 ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size); 233 ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size);
214 234
215 VMManager vm_manager;
216
217private: 235private:
218 explicit Process(KernelCore& kernel); 236 explicit Process(KernelCore& kernel);
219 ~Process() override; 237 ~Process() override;
220 238
239 /// Memory manager for this process.
240 Kernel::VMManager vm_manager;
241
221 /// Current status of the process 242 /// Current status of the process
222 ProcessStatus status; 243 ProcessStatus status;
223 244
224 /// The ID of this process 245 /// The ID of this process
225 u32 process_id = 0; 246 u32 process_id = 0;
226 247
248 /// Title ID corresponding to the process
249 u64 program_id;
250
251 /// Resource limit descriptor for this process
252 SharedPtr<ResourceLimit> resource_limit;
253
254 /// The process may only call SVCs which have the corresponding bit set.
255 std::bitset<0x80> svc_access_mask;
256 /// Maximum size of the handle table for the process.
257 u32 handle_table_size = 0x200;
258 /// Special memory ranges mapped into this processes address space. This is used to give
259 /// processes access to specific I/O regions and device memory.
260 boost::container::static_vector<AddressMapping, 8> address_mappings;
261 ProcessFlags flags;
262 /// Kernel compatibility version for this process
263 u16 kernel_version = 0;
264 /// The default CPU for this process, threads are scheduled on this cpu by default.
265 u8 ideal_processor = 0;
266 /// Bitmask of allowed CPUs that this process' threads can run on. TODO(Subv): Actually parse
267 /// this value from the process header.
268 u32 allowed_processor_mask = THREADPROCESSORID_DEFAULT_MASK;
269 u32 allowed_thread_priority_mask = 0xFFFFFFFF;
270 u32 is_virtual_address_memory_enabled = 0;
271
227 // Memory used to back the allocations in the regular heap. A single vector is used to cover 272 // Memory used to back the allocations in the regular heap. A single vector is used to cover
228 // the entire virtual address space extents that bound the allocations, including any holes. 273 // the entire virtual address space extents that bound the allocations, including any holes.
229 // This makes deallocation and reallocation of holes fast and keeps process memory contiguous 274 // This makes deallocation and reallocation of holes fast and keeps process memory contiguous