summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/process.h')
-rw-r--r--src/core/hle/kernel/process.h107
1 files changed, 81 insertions, 26 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index adb03c228..590e0c73d 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,45 @@ 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
192 /// Whether this process is an AArch64 or AArch32 process.
193 bool Is64BitProcess() const {
194 return is_64bit_process;
195 }
196
148 /** 197 /**
149 * Loads process-specifics configuration info with metadata provided 198 * Loads process-specifics configuration info with metadata provided
150 * by an executable. 199 * by an executable.
@@ -153,30 +202,6 @@ public:
153 */ 202 */
154 void LoadFromMetadata(const FileSys::ProgramMetadata& metadata); 203 void LoadFromMetadata(const FileSys::ProgramMetadata& metadata);
155 204
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 /** 205 /**
181 * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them 206 * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them
182 * to this process. 207 * to this process.
@@ -212,18 +237,43 @@ public:
212 237
213 ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size); 238 ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size);
214 239
215 VMManager vm_manager;
216
217private: 240private:
218 explicit Process(KernelCore& kernel); 241 explicit Process(KernelCore& kernel);
219 ~Process() override; 242 ~Process() override;
220 243
244 /// Memory manager for this process.
245 Kernel::VMManager vm_manager;
246
221 /// Current status of the process 247 /// Current status of the process
222 ProcessStatus status; 248 ProcessStatus status;
223 249
224 /// The ID of this process 250 /// The ID of this process
225 u32 process_id = 0; 251 u32 process_id = 0;
226 252
253 /// Title ID corresponding to the process
254 u64 program_id;
255
256 /// Resource limit descriptor for this process
257 SharedPtr<ResourceLimit> resource_limit;
258
259 /// The process may only call SVCs which have the corresponding bit set.
260 std::bitset<0x80> svc_access_mask;
261 /// Maximum size of the handle table for the process.
262 u32 handle_table_size = 0x200;
263 /// Special memory ranges mapped into this processes address space. This is used to give
264 /// processes access to specific I/O regions and device memory.
265 boost::container::static_vector<AddressMapping, 8> address_mappings;
266 ProcessFlags flags;
267 /// Kernel compatibility version for this process
268 u16 kernel_version = 0;
269 /// The default CPU for this process, threads are scheduled on this cpu by default.
270 u8 ideal_processor = 0;
271 /// Bitmask of allowed CPUs that this process' threads can run on. TODO(Subv): Actually parse
272 /// this value from the process header.
273 u32 allowed_processor_mask = THREADPROCESSORID_DEFAULT_MASK;
274 u32 allowed_thread_priority_mask = 0xFFFFFFFF;
275 u32 is_virtual_address_memory_enabled = 0;
276
227 // Memory used to back the allocations in the regular heap. A single vector is used to cover 277 // 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. 278 // 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 279 // This makes deallocation and reallocation of holes fast and keeps process memory contiguous
@@ -242,6 +292,11 @@ private:
242 /// This vector will grow as more pages are allocated for new threads. 292 /// This vector will grow as more pages are allocated for new threads.
243 std::vector<std::bitset<8>> tls_slots; 293 std::vector<std::bitset<8>> tls_slots;
244 294
295 /// Whether or not this process is AArch64, or AArch32.
296 /// By default, we currently assume this is true, unless otherwise
297 /// specified by metadata provided to the process during loading.
298 bool is_64bit_process = true;
299
245 std::string name; 300 std::string name;
246}; 301};
247 302