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.h53
1 files changed, 32 insertions, 21 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index d781ef32c..b566950b0 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -8,12 +8,9 @@
8#include <cstddef> 8#include <cstddef>
9#include <memory> 9#include <memory>
10#include <string> 10#include <string>
11
12#include <boost/container/static_vector.hpp> 11#include <boost/container/static_vector.hpp>
13
14#include "common/bit_field.h" 12#include "common/bit_field.h"
15#include "common/common_types.h" 13#include "common/common_types.h"
16
17#include "core/hle/kernel/kernel.h" 14#include "core/hle/kernel/kernel.h"
18#include "core/hle/kernel/vm_manager.h" 15#include "core/hle/kernel/vm_manager.h"
19 16
@@ -36,15 +33,18 @@ enum class MemoryRegion : u16 {
36union ProcessFlags { 33union ProcessFlags {
37 u16 raw; 34 u16 raw;
38 35
39 BitField< 0, 1, u16> allow_debug; ///< Allows other processes to attach to and debug this process. 36 BitField<0, 1, u16>
40 BitField< 1, 1, u16> force_debug; ///< Allows this process to attach to processes even if they don't have allow_debug set. 37 allow_debug; ///< Allows other processes to attach to and debug this process.
41 BitField< 2, 1, u16> allow_nonalphanum; 38 BitField<1, 1, u16> force_debug; ///< Allows this process to attach to processes even if they
42 BitField< 3, 1, u16> shared_page_writable; ///< Shared page is mapped with write permissions. 39 /// don't have allow_debug set.
43 BitField< 4, 1, u16> privileged_priority; ///< Can use priority levels higher than 24. 40 BitField<2, 1, u16> allow_nonalphanum;
44 BitField< 5, 1, u16> allow_main_args; 41 BitField<3, 1, u16> shared_page_writable; ///< Shared page is mapped with write permissions.
45 BitField< 6, 1, u16> shared_device_mem; 42 BitField<4, 1, u16> privileged_priority; ///< Can use priority levels higher than 24.
46 BitField< 7, 1, u16> runnable_on_sleep; 43 BitField<5, 1, u16> allow_main_args;
47 BitField< 8, 4, MemoryRegion> memory_region; ///< Default region for memory allocations for this process 44 BitField<6, 1, u16> shared_device_mem;
45 BitField<7, 1, u16> runnable_on_sleep;
46 BitField<8, 4, MemoryRegion>
47 memory_region; ///< Default region for memory allocations for this process
48 BitField<12, 1, u16> loaded_high; ///< Application loaded high (not at 0x00100000). 48 BitField<12, 1, u16> loaded_high; ///< Application loaded high (not at 0x00100000).
49}; 49};
50 50
@@ -54,11 +54,17 @@ struct MemoryRegionInfo;
54struct CodeSet final : public Object { 54struct CodeSet final : public Object {
55 static SharedPtr<CodeSet> Create(std::string name, u64 program_id); 55 static SharedPtr<CodeSet> Create(std::string name, u64 program_id);
56 56
57 std::string GetTypeName() const override { return "CodeSet"; } 57 std::string GetTypeName() const override {
58 std::string GetName() const override { return name; } 58 return "CodeSet";
59 }
60 std::string GetName() const override {
61 return name;
62 }
59 63
60 static const HandleType HANDLE_TYPE = HandleType::CodeSet; 64 static const HandleType HANDLE_TYPE = HandleType::CodeSet;
61 HandleType GetHandleType() const override { return HANDLE_TYPE; } 65 HandleType GetHandleType() const override {
66 return HANDLE_TYPE;
67 }
62 68
63 /// Name of the process 69 /// Name of the process
64 std::string name; 70 std::string name;
@@ -85,11 +91,17 @@ class Process final : public Object {
85public: 91public:
86 static SharedPtr<Process> Create(SharedPtr<CodeSet> code_set); 92 static SharedPtr<Process> Create(SharedPtr<CodeSet> code_set);
87 93
88 std::string GetTypeName() const override { return "Process"; } 94 std::string GetTypeName() const override {
89 std::string GetName() const override { return codeset->name; } 95 return "Process";
96 }
97 std::string GetName() const override {
98 return codeset->name;
99 }
90 100
91 static const HandleType HANDLE_TYPE = HandleType::Process; 101 static const HandleType HANDLE_TYPE = HandleType::Process;
92 HandleType GetHandleType() const override { return HANDLE_TYPE; } 102 HandleType GetHandleType() const override {
103 return HANDLE_TYPE;
104 }
93 105
94 static u32 next_process_id; 106 static u32 next_process_id;
95 107
@@ -124,7 +136,6 @@ public:
124 */ 136 */
125 void Run(s32 main_thread_priority, u32 stack_size); 137 void Run(s32 main_thread_priority, u32 stack_size);
126 138
127
128 /////////////////////////////////////////////////////////////////////////////////////////////// 139 ///////////////////////////////////////////////////////////////////////////////////////////////
129 // Memory Management 140 // Memory Management
130 141
@@ -144,7 +155,8 @@ public:
144 155
145 /// The Thread Local Storage area is allocated as processes create threads, 156 /// The Thread Local Storage area is allocated as processes create threads,
146 /// each TLS area is 0x200 bytes, so one page (0x1000) is split up in 8 parts, and each part 157 /// each TLS area is 0x200 bytes, so one page (0x1000) is split up in 8 parts, and each part
147 /// holds the TLS for a specific thread. This vector contains which parts are in use for each page as a bitmask. 158 /// holds the TLS for a specific thread. This vector contains which parts are in use for each
159 /// page as a bitmask.
148 /// This vector will grow as more pages are allocated for new threads. 160 /// This vector will grow as more pages are allocated for new threads.
149 std::vector<std::bitset<8>> tls_slots; 161 std::vector<std::bitset<8>> tls_slots;
150 162
@@ -164,5 +176,4 @@ private:
164}; 176};
165 177
166extern SharedPtr<Process> g_current_process; 178extern SharedPtr<Process> g_current_process;
167
168} 179}