summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.h
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-07-17 23:19:16 -0300
committerGravatar Yuri Kunde Schlesner2015-08-16 01:03:45 -0300
commitcdeeecf0807d0005356f30db0f7164c5891a9245 (patch)
treee32e6d673cdac358df0abd3d3ece13f37c1c28d5 /src/core/hle/kernel/process.h
parentMemory: Move PAGE_MASK and PAGE_BITS to memory.h (diff)
downloadyuzu-cdeeecf0807d0005356f30db0f7164c5891a9245.tar.gz
yuzu-cdeeecf0807d0005356f30db0f7164c5891a9245.tar.xz
yuzu-cdeeecf0807d0005356f30db0f7164c5891a9245.zip
Kernel: Properly implement ControlMemory FREE and COMMIT
Diffstat (limited to 'src/core/hle/kernel/process.h')
-rw-r--r--src/core/hle/kernel/process.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 83d3aceae..567d5df18 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -15,6 +15,7 @@
15#include "common/common_types.h" 15#include "common/common_types.h"
16 16
17#include "core/hle/kernel/kernel.h" 17#include "core/hle/kernel/kernel.h"
18#include "core/hle/kernel/vm_manager.h"
18 19
19namespace Kernel { 20namespace Kernel {
20 21
@@ -48,7 +49,6 @@ union ProcessFlags {
48}; 49};
49 50
50class ResourceLimit; 51class ResourceLimit;
51class VMManager;
52 52
53struct CodeSet final : public Object { 53struct CodeSet final : public Object {
54 static SharedPtr<CodeSet> Create(std::string name, u64 program_id); 54 static SharedPtr<CodeSet> Create(std::string name, u64 program_id);
@@ -108,10 +108,6 @@ public:
108 /// The id of this process 108 /// The id of this process
109 u32 process_id = next_process_id++; 109 u32 process_id = next_process_id++;
110 110
111 /// Bitmask of the used TLS slots
112 std::bitset<300> used_tls_slots;
113 std::unique_ptr<VMManager> address_space;
114
115 /** 111 /**
116 * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them 112 * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them
117 * to this process. 113 * to this process.
@@ -123,6 +119,31 @@ public:
123 */ 119 */
124 void Run(s32 main_thread_priority, u32 stack_size); 120 void Run(s32 main_thread_priority, u32 stack_size);
125 121
122
123 ///////////////////////////////////////////////////////////////////////////////////////////////
124 // Memory Management
125
126 VMManager vm_manager;
127
128 // Memory used to back the allocations in the regular heap. A single vector is used to cover
129 // the entire virtual address space extents that bound the allocations, including any holes.
130 // This makes deallocation and reallocation of holes fast and keeps process memory contiguous
131 // in the emulator address space, allowing Memory::GetPointer to be reasonably safe.
132 std::shared_ptr<std::vector<u8>> heap_memory;
133 // The left/right bounds of the address space covered by heap_memory.
134 VAddr heap_start = 0, heap_end = 0;
135
136 std::shared_ptr<std::vector<u8>> linear_heap_memory;
137
138 /// Bitmask of the used TLS slots
139 std::bitset<300> used_tls_slots;
140
141 ResultVal<VAddr> HeapAllocate(VAddr target, u32 size, VMAPermission perms);
142 ResultCode HeapFree(VAddr target, u32 size);
143
144 ResultVal<VAddr> LinearAllocate(VAddr target, u32 size, VMAPermission perms);
145 ResultCode LinearFree(VAddr target, u32 size);
146
126private: 147private:
127 Process(); 148 Process();
128 ~Process() override; 149 ~Process() override;