summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/process.cpp5
-rw-r--r--src/core/hle/kernel/process.h8
-rw-r--r--src/core/hle/kernel/svc.cpp4
3 files changed, 14 insertions, 3 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 90d579b5c..73ee1eb0f 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -187,6 +187,8 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) {
187 187
188void Process::Run(s32 main_thread_priority, u64 stack_size) { 188void Process::Run(s32 main_thread_priority, u64 stack_size) {
189 AllocateMainThreadStack(stack_size); 189 AllocateMainThreadStack(stack_size);
190 tls_region_address = CreateTLSRegion();
191
190 vm_manager.LogLayout(); 192 vm_manager.LogLayout();
191 193
192 ChangeStatus(ProcessStatus::Running); 194 ChangeStatus(ProcessStatus::Running);
@@ -218,6 +220,9 @@ void Process::PrepareForTermination() {
218 stop_threads(system.Scheduler(2).GetThreadList()); 220 stop_threads(system.Scheduler(2).GetThreadList());
219 stop_threads(system.Scheduler(3).GetThreadList()); 221 stop_threads(system.Scheduler(3).GetThreadList());
220 222
223 FreeTLSRegion(tls_region_address);
224 tls_region_address = 0;
225
221 ChangeStatus(ProcessStatus::Exited); 226 ChangeStatus(ProcessStatus::Exited);
222} 227}
223 228
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 492d8ea4f..afde9567e 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -135,6 +135,11 @@ public:
135 return mutex; 135 return mutex;
136 } 136 }
137 137
138 /// Gets the address to the process' dedicated TLS region.
139 VAddr GetTLSRegionAddress() const {
140 return tls_region_address;
141 }
142
138 /// Gets the current status of the process 143 /// Gets the current status of the process
139 ProcessStatus GetStatus() const { 144 ProcessStatus GetStatus() const {
140 return status; 145 return status;
@@ -341,6 +346,9 @@ private:
341 /// variable related facilities. 346 /// variable related facilities.
342 Mutex mutex; 347 Mutex mutex;
343 348
349 /// Address indicating the location of the process' dedicated TLS region.
350 VAddr tls_region_address = 0;
351
344 /// Random values for svcGetInfo RandomEntropy 352 /// Random values for svcGetInfo RandomEntropy
345 std::array<u64, RANDOM_ENTROPY_SIZE> random_entropy{}; 353 std::array<u64, RANDOM_ENTROPY_SIZE> random_entropy{};
346 354
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 332573a95..762117127 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -831,9 +831,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
831 return RESULT_SUCCESS; 831 return RESULT_SUCCESS;
832 832
833 case GetInfoType::UserExceptionContextAddr: 833 case GetInfoType::UserExceptionContextAddr:
834 LOG_WARNING(Kernel_SVC, 834 *result = process->GetTLSRegionAddress();
835 "(STUBBED) Attempted to query user exception context address, returned 0");
836 *result = 0;
837 return RESULT_SUCCESS; 835 return RESULT_SUCCESS;
838 836
839 case GetInfoType::TotalPhysicalMemoryAvailableWithoutMmHeap: 837 case GetInfoType::TotalPhysicalMemoryAvailableWithoutMmHeap: