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.h55
1 files changed, 39 insertions, 16 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 81538f70c..04d74e572 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -131,6 +131,16 @@ public:
131 return HANDLE_TYPE; 131 return HANDLE_TYPE;
132 } 132 }
133 133
134 /// Gets the current status of the process
135 ProcessStatus GetStatus() const {
136 return status;
137 }
138
139 /// Gets the unique ID that identifies this particular process.
140 u32 GetProcessID() const {
141 return process_id;
142 }
143
134 /// Title ID corresponding to the process 144 /// Title ID corresponding to the process
135 u64 program_id; 145 u64 program_id;
136 146
@@ -154,11 +164,6 @@ public:
154 u32 allowed_processor_mask = THREADPROCESSORID_DEFAULT_MASK; 164 u32 allowed_processor_mask = THREADPROCESSORID_DEFAULT_MASK;
155 u32 allowed_thread_priority_mask = 0xFFFFFFFF; 165 u32 allowed_thread_priority_mask = 0xFFFFFFFF;
156 u32 is_virtual_address_memory_enabled = 0; 166 u32 is_virtual_address_memory_enabled = 0;
157 /// Current status of the process
158 ProcessStatus status;
159
160 /// The ID of this process
161 u32 process_id = 0;
162 167
163 /** 168 /**
164 * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them 169 * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them
@@ -171,13 +176,42 @@ public:
171 */ 176 */
172 void Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size); 177 void Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size);
173 178
179 /**
180 * Prepares a process for termination by stopping all of its threads
181 * and clearing any other resources.
182 */
183 void PrepareForTermination();
184
174 void LoadModule(SharedPtr<CodeSet> module_, VAddr base_addr); 185 void LoadModule(SharedPtr<CodeSet> module_, VAddr base_addr);
175 186
176 /////////////////////////////////////////////////////////////////////////////////////////////// 187 ///////////////////////////////////////////////////////////////////////////////////////////////
177 // Memory Management 188 // Memory Management
178 189
190 // Marks the next available region as used and returns the address of the slot.
191 VAddr MarkNextAvailableTLSSlotAsUsed(Thread& thread);
192
193 // Frees a used TLS slot identified by the given address
194 void FreeTLSSlot(VAddr tls_address);
195
196 ResultVal<VAddr> HeapAllocate(VAddr target, u64 size, VMAPermission perms);
197 ResultCode HeapFree(VAddr target, u32 size);
198
199 ResultCode MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size);
200
201 ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size);
202
179 VMManager vm_manager; 203 VMManager vm_manager;
180 204
205private:
206 explicit Process(KernelCore& kernel);
207 ~Process() override;
208
209 /// Current status of the process
210 ProcessStatus status;
211
212 /// The ID of this process
213 u32 process_id = 0;
214
181 // Memory used to back the allocations in the regular heap. A single vector is used to cover 215 // Memory used to back the allocations in the regular heap. A single vector is used to cover
182 // the entire virtual address space extents that bound the allocations, including any holes. 216 // the entire virtual address space extents that bound the allocations, including any holes.
183 // This makes deallocation and reallocation of holes fast and keeps process memory contiguous 217 // This makes deallocation and reallocation of holes fast and keeps process memory contiguous
@@ -197,17 +231,6 @@ public:
197 std::vector<std::bitset<8>> tls_slots; 231 std::vector<std::bitset<8>> tls_slots;
198 232
199 std::string name; 233 std::string name;
200
201 ResultVal<VAddr> HeapAllocate(VAddr target, u64 size, VMAPermission perms);
202 ResultCode HeapFree(VAddr target, u32 size);
203
204 ResultCode MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size);
205
206 ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size);
207
208private:
209 explicit Process(KernelCore& kernel);
210 ~Process() override;
211}; 234};
212 235
213} // namespace Kernel 236} // namespace Kernel