diff options
Diffstat (limited to 'src/core/hle/kernel/process.h')
| -rw-r--r-- | src/core/hle/kernel/process.h | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 4887132a7..9dabe3568 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include "core/hle/kernel/mutex.h" | 16 | #include "core/hle/kernel/mutex.h" |
| 17 | #include "core/hle/kernel/process_capability.h" | 17 | #include "core/hle/kernel/process_capability.h" |
| 18 | #include "core/hle/kernel/synchronization_object.h" | 18 | #include "core/hle/kernel/synchronization_object.h" |
| 19 | #include "core/hle/kernel/vm_manager.h" | ||
| 20 | #include "core/hle/result.h" | 19 | #include "core/hle/result.h" |
| 21 | 20 | ||
| 22 | namespace Core { | 21 | namespace Core { |
| @@ -36,6 +35,10 @@ class TLSPage; | |||
| 36 | 35 | ||
| 37 | struct CodeSet; | 36 | struct CodeSet; |
| 38 | 37 | ||
| 38 | namespace Memory { | ||
| 39 | class PageTable; | ||
| 40 | } | ||
| 41 | |||
| 39 | enum class MemoryRegion : u16 { | 42 | enum class MemoryRegion : u16 { |
| 40 | APPLICATION = 1, | 43 | APPLICATION = 1, |
| 41 | SYSTEM = 2, | 44 | SYSTEM = 2, |
| @@ -100,14 +103,14 @@ public: | |||
| 100 | return HANDLE_TYPE; | 103 | return HANDLE_TYPE; |
| 101 | } | 104 | } |
| 102 | 105 | ||
| 103 | /// Gets a reference to the process' memory manager. | 106 | /// Gets a reference to the process' page table. |
| 104 | Kernel::VMManager& VMManager() { | 107 | Memory::PageTable& PageTable() { |
| 105 | return vm_manager; | 108 | return *page_table; |
| 106 | } | 109 | } |
| 107 | 110 | ||
| 108 | /// Gets a const reference to the process' memory manager. | 111 | /// Gets const a reference to the process' page table. |
| 109 | const Kernel::VMManager& VMManager() const { | 112 | const Memory::PageTable& PageTable() const { |
| 110 | return vm_manager; | 113 | return *page_table; |
| 111 | } | 114 | } |
| 112 | 115 | ||
| 113 | /// Gets a reference to the process' handle table. | 116 | /// Gets a reference to the process' handle table. |
| @@ -273,7 +276,7 @@ public: | |||
| 273 | * @returns RESULT_SUCCESS if all relevant metadata was able to be | 276 | * @returns RESULT_SUCCESS if all relevant metadata was able to be |
| 274 | * loaded and parsed. Otherwise, an error code is returned. | 277 | * loaded and parsed. Otherwise, an error code is returned. |
| 275 | */ | 278 | */ |
| 276 | ResultCode LoadFromMetadata(const FileSys::ProgramMetadata& metadata); | 279 | ResultCode LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size); |
| 277 | 280 | ||
| 278 | /** | 281 | /** |
| 279 | * Starts the main application thread for this process. | 282 | * Starts the main application thread for this process. |
| @@ -289,7 +292,7 @@ public: | |||
| 289 | */ | 292 | */ |
| 290 | void PrepareForTermination(); | 293 | void PrepareForTermination(); |
| 291 | 294 | ||
| 292 | void LoadModule(CodeSet module_, VAddr base_addr); | 295 | void LoadModule(CodeSet code_set, VAddr base_addr); |
| 293 | 296 | ||
| 294 | /////////////////////////////////////////////////////////////////////////////////////////////// | 297 | /////////////////////////////////////////////////////////////////////////////////////////////// |
| 295 | // Thread-local storage management | 298 | // Thread-local storage management |
| @@ -313,16 +316,10 @@ private: | |||
| 313 | void ChangeStatus(ProcessStatus new_status); | 316 | void ChangeStatus(ProcessStatus new_status); |
| 314 | 317 | ||
| 315 | /// Allocates the main thread stack for the process, given the stack size in bytes. | 318 | /// Allocates the main thread stack for the process, given the stack size in bytes. |
| 316 | void AllocateMainThreadStack(u64 stack_size); | 319 | ResultCode AllocateMainThreadStack(std::size_t stack_size); |
| 317 | |||
| 318 | /// Memory manager for this process. | ||
| 319 | Kernel::VMManager vm_manager; | ||
| 320 | |||
| 321 | /// Size of the main thread's stack in bytes. | ||
| 322 | u64 main_thread_stack_size = 0; | ||
| 323 | 320 | ||
| 324 | /// Size of the loaded code memory in bytes. | 321 | /// Memory manager for this process |
| 325 | u64 code_memory_size = 0; | 322 | std::unique_ptr<Memory::PageTable> page_table; |
| 326 | 323 | ||
| 327 | /// Current status of the process | 324 | /// Current status of the process |
| 328 | ProcessStatus status{}; | 325 | ProcessStatus status{}; |
| @@ -390,6 +387,18 @@ private: | |||
| 390 | 387 | ||
| 391 | /// Name of this process | 388 | /// Name of this process |
| 392 | std::string name; | 389 | std::string name; |
| 390 | |||
| 391 | /// Address of the top of the main thread's stack | ||
| 392 | VAddr main_thread_stack_top{}; | ||
| 393 | |||
| 394 | /// Size of the main thread's stack | ||
| 395 | std::size_t main_thread_stack_size{}; | ||
| 396 | |||
| 397 | /// Memory usage capacity for the process | ||
| 398 | std::size_t memory_usage_capacity{}; | ||
| 399 | |||
| 400 | /// Process total image size | ||
| 401 | std::size_t image_size{}; | ||
| 393 | }; | 402 | }; |
| 394 | 403 | ||
| 395 | } // namespace Kernel | 404 | } // namespace Kernel |