diff options
Diffstat (limited to 'src/core/hle/kernel/process.h')
| -rw-r--r-- | src/core/hle/kernel/process.h | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 83d3aceae..60e17f251 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 | ||
| 19 | namespace Kernel { | 20 | namespace Kernel { |
| 20 | 21 | ||
| @@ -48,7 +49,7 @@ union ProcessFlags { | |||
| 48 | }; | 49 | }; |
| 49 | 50 | ||
| 50 | class ResourceLimit; | 51 | class ResourceLimit; |
| 51 | class VMManager; | 52 | struct MemoryRegionInfo; |
| 52 | 53 | ||
| 53 | struct CodeSet final : public Object { | 54 | struct CodeSet final : public Object { |
| 54 | static SharedPtr<CodeSet> Create(std::string name, u64 program_id); | 55 | static SharedPtr<CodeSet> Create(std::string name, u64 program_id); |
| @@ -104,14 +105,12 @@ public: | |||
| 104 | /// processes access to specific I/O regions and device memory. | 105 | /// processes access to specific I/O regions and device memory. |
| 105 | boost::container::static_vector<AddressMapping, 8> address_mappings; | 106 | boost::container::static_vector<AddressMapping, 8> address_mappings; |
| 106 | ProcessFlags flags; | 107 | ProcessFlags flags; |
| 108 | /// Kernel compatibility version for this process | ||
| 109 | u16 kernel_version = 0; | ||
| 107 | 110 | ||
| 108 | /// The id of this process | 111 | /// The id of this process |
| 109 | u32 process_id = next_process_id++; | 112 | u32 process_id = next_process_id++; |
| 110 | 113 | ||
| 111 | /// Bitmask of the used TLS slots | ||
| 112 | std::bitset<300> used_tls_slots; | ||
| 113 | std::unique_ptr<VMManager> address_space; | ||
| 114 | |||
| 115 | /** | 114 | /** |
| 116 | * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them | 115 | * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them |
| 117 | * to this process. | 116 | * to this process. |
| @@ -123,6 +122,36 @@ public: | |||
| 123 | */ | 122 | */ |
| 124 | void Run(s32 main_thread_priority, u32 stack_size); | 123 | void Run(s32 main_thread_priority, u32 stack_size); |
| 125 | 124 | ||
| 125 | |||
| 126 | /////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 127 | // Memory Management | ||
| 128 | |||
| 129 | VMManager vm_manager; | ||
| 130 | |||
| 131 | // Memory used to back the allocations in the regular heap. A single vector is used to cover | ||
| 132 | // the entire virtual address space extents that bound the allocations, including any holes. | ||
| 133 | // This makes deallocation and reallocation of holes fast and keeps process memory contiguous | ||
| 134 | // in the emulator address space, allowing Memory::GetPointer to be reasonably safe. | ||
| 135 | std::shared_ptr<std::vector<u8>> heap_memory; | ||
| 136 | // The left/right bounds of the address space covered by heap_memory. | ||
| 137 | VAddr heap_start = 0, heap_end = 0; | ||
| 138 | |||
| 139 | u32 heap_used = 0, linear_heap_used = 0, misc_memory_used = 0; | ||
| 140 | |||
| 141 | MemoryRegionInfo* memory_region = nullptr; | ||
| 142 | |||
| 143 | /// Bitmask of the used TLS slots | ||
| 144 | std::bitset<300> used_tls_slots; | ||
| 145 | |||
| 146 | VAddr GetLinearHeapBase() const; | ||
| 147 | VAddr GetLinearHeapLimit() const; | ||
| 148 | |||
| 149 | ResultVal<VAddr> HeapAllocate(VAddr target, u32 size, VMAPermission perms); | ||
| 150 | ResultCode HeapFree(VAddr target, u32 size); | ||
| 151 | |||
| 152 | ResultVal<VAddr> LinearAllocate(VAddr target, u32 size, VMAPermission perms); | ||
| 153 | ResultCode LinearFree(VAddr target, u32 size); | ||
| 154 | |||
| 126 | private: | 155 | private: |
| 127 | Process(); | 156 | Process(); |
| 128 | ~Process() override; | 157 | ~Process() override; |