summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-13 17:49:59 -0400
committerGravatar bunnei2018-03-14 18:42:19 -0400
commit7d6653268f68dea8bc39288e3a27bc499b7b8154 (patch)
tree6330442e1dacc0d850ce09c35dcee7ddd3a2bc9d /src/core/hle/kernel
parentMerge pull request #213 from Hexagon12/dynarmic-default (diff)
downloadyuzu-7d6653268f68dea8bc39288e3a27bc499b7b8154.tar.gz
yuzu-7d6653268f68dea8bc39288e3a27bc499b7b8154.tar.xz
yuzu-7d6653268f68dea8bc39288e3a27bc499b7b8154.zip
core: Move process creation out of global state.
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/handle_table.cpp3
-rw-r--r--src/core/hle/kernel/kernel.cpp1
-rw-r--r--src/core/hle/kernel/process.cpp5
-rw-r--r--src/core/hle/kernel/process.h3
-rw-r--r--src/core/hle/kernel/scheduler.cpp7
-rw-r--r--src/core/hle/kernel/server_session.cpp3
-rw-r--r--src/core/hle/kernel/shared_memory.cpp5
-rw-r--r--src/core/hle/kernel/svc.cpp38
-rw-r--r--src/core/hle/kernel/thread.cpp4
9 files changed, 36 insertions, 33 deletions
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp
index 3beb55753..822449cd5 100644
--- a/src/core/hle/kernel/handle_table.cpp
+++ b/src/core/hle/kernel/handle_table.cpp
@@ -5,6 +5,7 @@
5#include <utility> 5#include <utility>
6#include "common/assert.h" 6#include "common/assert.h"
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core.h"
8#include "core/hle/kernel/errors.h" 9#include "core/hle/kernel/errors.h"
9#include "core/hle/kernel/handle_table.h" 10#include "core/hle/kernel/handle_table.h"
10#include "core/hle/kernel/kernel.h" 11#include "core/hle/kernel/kernel.h"
@@ -77,7 +78,7 @@ SharedPtr<Object> HandleTable::GetGeneric(Handle handle) const {
77 if (handle == CurrentThread) { 78 if (handle == CurrentThread) {
78 return GetCurrentThread(); 79 return GetCurrentThread();
79 } else if (handle == CurrentProcess) { 80 } else if (handle == CurrentProcess) {
80 return g_current_process; 81 return Core::CurrentProcess();
81 } 82 }
82 83
83 if (!IsValid(handle)) { 84 if (!IsValid(handle)) {
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index b0c3f4ae1..b325b879b 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -41,7 +41,6 @@ void Shutdown() {
41 g_object_address_table.Clear(); 41 g_object_address_table.Clear();
42 42
43 Kernel::ThreadingShutdown(); 43 Kernel::ThreadingShutdown();
44 g_current_process = nullptr;
45 44
46 Kernel::TimersShutdown(); 45 Kernel::TimersShutdown();
47 Kernel::ResourceLimitsShutdown(); 46 Kernel::ResourceLimitsShutdown();
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index bb6dc28d7..9ca2374ea 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -31,14 +31,14 @@ CodeSet::~CodeSet() {}
31 31
32u32 Process::next_process_id; 32u32 Process::next_process_id;
33 33
34SharedPtr<Process> Process::Create(std::string&& name, u64 program_id) { 34SharedPtr<Process> Process::Create(std::string&& name) {
35 SharedPtr<Process> process(new Process); 35 SharedPtr<Process> process(new Process);
36 36
37 process->name = std::move(name); 37 process->name = std::move(name);
38 process->flags.raw = 0; 38 process->flags.raw = 0;
39 process->flags.memory_region.Assign(MemoryRegion::APPLICATION); 39 process->flags.memory_region.Assign(MemoryRegion::APPLICATION);
40 process->status = ProcessStatus::Created; 40 process->status = ProcessStatus::Created;
41 process->program_id = program_id; 41 process->program_id = 0;
42 42
43 process_list.push_back(process); 43 process_list.push_back(process);
44 return process; 44 return process;
@@ -319,5 +319,4 @@ SharedPtr<Process> GetProcessById(u32 process_id) {
319 return *itr; 319 return *itr;
320} 320}
321 321
322SharedPtr<Process> g_current_process;
323} // namespace Kernel 322} // namespace Kernel
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 1de12efd3..68e77a4d1 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -95,7 +95,7 @@ private:
95 95
96class Process final : public Object { 96class Process final : public Object {
97public: 97public:
98 static SharedPtr<Process> Create(std::string&& name, u64 program_id); 98 static SharedPtr<Process> Create(std::string&& name);
99 99
100 std::string GetTypeName() const override { 100 std::string GetTypeName() const override {
101 return "Process"; 101 return "Process";
@@ -203,5 +203,4 @@ void ClearProcessList();
203/// Retrieves a process from the current list of processes. 203/// Retrieves a process from the current list of processes.
204SharedPtr<Process> GetProcessById(u32 process_id); 204SharedPtr<Process> GetProcessById(u32 process_id);
205 205
206extern SharedPtr<Process> g_current_process;
207} // namespace Kernel 206} // namespace Kernel
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 235068b22..921f27efb 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "core/core.h"
5#include "core/core_timing.h" 6#include "core/core_timing.h"
6#include "core/hle/kernel/process.h" 7#include "core/hle/kernel/process.h"
7#include "core/hle/kernel/scheduler.h" 8#include "core/hle/kernel/scheduler.h"
@@ -67,7 +68,7 @@ void Scheduler::SwitchContext(Thread* new_thread) {
67 // Cancel any outstanding wakeup events for this thread 68 // Cancel any outstanding wakeup events for this thread
68 new_thread->CancelWakeupTimer(); 69 new_thread->CancelWakeupTimer();
69 70
70 auto previous_process = Kernel::g_current_process; 71 auto previous_process = Core::CurrentProcess();
71 72
72 current_thread = new_thread; 73 current_thread = new_thread;
73 74
@@ -75,8 +76,8 @@ void Scheduler::SwitchContext(Thread* new_thread) {
75 new_thread->status = THREADSTATUS_RUNNING; 76 new_thread->status = THREADSTATUS_RUNNING;
76 77
77 if (previous_process != current_thread->owner_process) { 78 if (previous_process != current_thread->owner_process) {
78 Kernel::g_current_process = current_thread->owner_process; 79 Core::CurrentProcess() = current_thread->owner_process;
79 SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table); 80 SetCurrentPageTable(&Core::CurrentProcess()->vm_manager.page_table);
80 } 81 }
81 82
82 cpu_core->LoadContext(new_thread->context); 83 cpu_core->LoadContext(new_thread->context);
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp
index 5f31cf19b..9b4a0ef0a 100644
--- a/src/core/hle/kernel/server_session.cpp
+++ b/src/core/hle/kernel/server_session.cpp
@@ -4,6 +4,7 @@
4 4
5#include <tuple> 5#include <tuple>
6 6
7#include "core/core.h"
7#include "core/hle/ipc_helpers.h" 8#include "core/hle/ipc_helpers.h"
8#include "core/hle/kernel/client_port.h" 9#include "core/hle/kernel/client_port.h"
9#include "core/hle/kernel/client_session.h" 10#include "core/hle/kernel/client_session.h"
@@ -91,7 +92,7 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
91 92
92 Kernel::HLERequestContext context(this); 93 Kernel::HLERequestContext context(this);
93 u32* cmd_buf = (u32*)Memory::GetPointer(thread->GetTLSAddress()); 94 u32* cmd_buf = (u32*)Memory::GetPointer(thread->GetTLSAddress());
94 context.PopulateFromIncomingCommandBuffer(cmd_buf, *Kernel::g_current_process, 95 context.PopulateFromIncomingCommandBuffer(cmd_buf, *Core::CurrentProcess(),
95 Kernel::g_handle_table); 96 Kernel::g_handle_table);
96 97
97 ResultCode result = RESULT_SUCCESS; 98 ResultCode result = RESULT_SUCCESS;
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index d4505061e..4d6cd7462 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -4,6 +4,7 @@
4 4
5#include <cstring> 5#include <cstring>
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/core.h"
7#include "core/hle/kernel/errors.h" 8#include "core/hle/kernel/errors.h"
8#include "core/hle/kernel/memory.h" 9#include "core/hle/kernel/memory.h"
9#include "core/hle/kernel/shared_memory.h" 10#include "core/hle/kernel/shared_memory.h"
@@ -51,8 +52,8 @@ SharedPtr<SharedMemory> SharedMemory::Create(SharedPtr<Process> owner_process, u
51 } 52 }
52 53
53 // Refresh the address mappings for the current process. 54 // Refresh the address mappings for the current process.
54 if (Kernel::g_current_process != nullptr) { 55 if (Core::CurrentProcess() != nullptr) {
55 Kernel::g_current_process->vm_manager.RefreshMemoryBlockMappings(linheap_memory.get()); 56 Core::CurrentProcess()->vm_manager.RefreshMemoryBlockMappings(linheap_memory.get());
56 } 57 }
57 } else { 58 } else {
58 auto& vm_manager = shared_memory->owner_process->vm_manager; 59 auto& vm_manager = shared_memory->owner_process->vm_manager;
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 1ab8cbd88..207583320 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -8,6 +8,7 @@
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "common/microprofile.h" 9#include "common/microprofile.h"
10#include "common/string_util.h" 10#include "common/string_util.h"
11#include "core/core.h"
11#include "core/core_timing.h" 12#include "core/core_timing.h"
12#include "core/hle/kernel/client_port.h" 13#include "core/hle/kernel/client_port.h"
13#include "core/hle/kernel/client_session.h" 14#include "core/hle/kernel/client_session.h"
@@ -31,7 +32,7 @@ namespace Kernel {
31/// Set the process heap to a given Size. It can both extend and shrink the heap. 32/// Set the process heap to a given Size. It can both extend and shrink the heap.
32static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { 33static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
33 LOG_TRACE(Kernel_SVC, "called, heap_size=0x%llx", heap_size); 34 LOG_TRACE(Kernel_SVC, "called, heap_size=0x%llx", heap_size);
34 auto& process = *g_current_process; 35 auto& process = *Core::CurrentProcess();
35 CASCADE_RESULT(*heap_addr, 36 CASCADE_RESULT(*heap_addr,
36 process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); 37 process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite));
37 return RESULT_SUCCESS; 38 return RESULT_SUCCESS;
@@ -46,14 +47,14 @@ static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state
46static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { 47static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
47 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x%llx, src_addr=0x%llx, size=0x%llx", dst_addr, 48 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x%llx, src_addr=0x%llx, size=0x%llx", dst_addr,
48 src_addr, size); 49 src_addr, size);
49 return g_current_process->MirrorMemory(dst_addr, src_addr, size); 50 return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size);
50} 51}
51 52
52/// Unmaps a region that was previously mapped with svcMapMemory 53/// Unmaps a region that was previously mapped with svcMapMemory
53static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { 54static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
54 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x%llx, src_addr=0x%llx, size=0x%llx", dst_addr, 55 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x%llx, src_addr=0x%llx, size=0x%llx", dst_addr,
55 src_addr, size); 56 src_addr, size);
56 return g_current_process->UnmapMemory(dst_addr, src_addr, size); 57 return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size);
57} 58}
58 59
59/// Connect to an OS service given the port name, returns the handle to the port to out 60/// Connect to an OS service given the port name, returns the handle to the port to out
@@ -306,14 +307,14 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
306 LOG_TRACE(Kernel_SVC, "called info_id=0x%X, info_sub_id=0x%X, handle=0x%08X", info_id, 307 LOG_TRACE(Kernel_SVC, "called info_id=0x%X, info_sub_id=0x%X, handle=0x%08X", info_id,
307 info_sub_id, handle); 308 info_sub_id, handle);
308 309
309 auto& vm_manager = g_current_process->vm_manager; 310 auto& vm_manager = Core::CurrentProcess()->vm_manager;
310 311
311 switch (static_cast<GetInfoType>(info_id)) { 312 switch (static_cast<GetInfoType>(info_id)) {
312 case GetInfoType::AllowedCpuIdBitmask: 313 case GetInfoType::AllowedCpuIdBitmask:
313 *result = g_current_process->allowed_processor_mask; 314 *result = Core::CurrentProcess()->allowed_processor_mask;
314 break; 315 break;
315 case GetInfoType::AllowedThreadPrioBitmask: 316 case GetInfoType::AllowedThreadPrioBitmask:
316 *result = g_current_process->allowed_thread_priority_mask; 317 *result = Core::CurrentProcess()->allowed_thread_priority_mask;
317 break; 318 break;
318 case GetInfoType::MapRegionBaseAddr: 319 case GetInfoType::MapRegionBaseAddr:
319 *result = vm_manager.GetMapRegionBaseAddr(); 320 *result = vm_manager.GetMapRegionBaseAddr();
@@ -352,7 +353,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
352 *result = vm_manager.GetNewMapRegionSize(); 353 *result = vm_manager.GetNewMapRegionSize();
353 break; 354 break;
354 case GetInfoType::IsVirtualAddressMemoryEnabled: 355 case GetInfoType::IsVirtualAddressMemoryEnabled:
355 *result = g_current_process->is_virtual_address_memory_enabled; 356 *result = Core::CurrentProcess()->is_virtual_address_memory_enabled;
356 break; 357 break;
357 case GetInfoType::TitleId: 358 case GetInfoType::TitleId:
358 LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); 359 LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0");
@@ -392,7 +393,7 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) {
392 393
393 // Note: The kernel uses the current process's resource limit instead of 394 // Note: The kernel uses the current process's resource limit instead of
394 // the one from the thread owner's resource limit. 395 // the one from the thread owner's resource limit.
395 SharedPtr<ResourceLimit>& resource_limit = g_current_process->resource_limit; 396 SharedPtr<ResourceLimit>& resource_limit = Core::CurrentProcess()->resource_limit;
396 if (resource_limit->GetMaxResourceValue(ResourceTypes::PRIORITY) > priority) { 397 if (resource_limit->GetMaxResourceValue(ResourceTypes::PRIORITY) > priority) {
397 return ERR_NOT_AUTHORIZED; 398 return ERR_NOT_AUTHORIZED;
398 } 399 }
@@ -435,7 +436,7 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s
435 case MemoryPermission::WriteExecute: 436 case MemoryPermission::WriteExecute:
436 case MemoryPermission::ReadWriteExecute: 437 case MemoryPermission::ReadWriteExecute:
437 case MemoryPermission::DontCare: 438 case MemoryPermission::DontCare:
438 return shared_memory->Map(g_current_process.get(), addr, permissions_type, 439 return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type,
439 MemoryPermission::DontCare); 440 MemoryPermission::DontCare);
440 default: 441 default:
441 LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions); 442 LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions);
@@ -451,7 +452,7 @@ static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64
451 452
452 SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); 453 SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle);
453 454
454 return shared_memory->Unmap(g_current_process.get(), addr); 455 return shared_memory->Unmap(Core::CurrentProcess().get(), addr);
455} 456}
456 457
457/// Query process memory 458/// Query process memory
@@ -463,7 +464,7 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i
463 } 464 }
464 auto vma = process->vm_manager.FindVMA(addr); 465 auto vma = process->vm_manager.FindVMA(addr);
465 memory_info->attributes = 0; 466 memory_info->attributes = 0;
466 if (vma == g_current_process->vm_manager.vma_map.end()) { 467 if (vma == Core::CurrentProcess()->vm_manager.vma_map.end()) {
467 memory_info->base_address = 0; 468 memory_info->base_address = 0;
468 memory_info->permission = static_cast<u32>(VMAPermission::None); 469 memory_info->permission = static_cast<u32>(VMAPermission::None);
469 memory_info->size = 0; 470 memory_info->size = 0;
@@ -487,16 +488,17 @@ static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAdd
487 488
488/// Exits the current process 489/// Exits the current process
489static void ExitProcess() { 490static void ExitProcess() {
490 LOG_INFO(Kernel_SVC, "Process %u exiting", g_current_process->process_id); 491 LOG_INFO(Kernel_SVC, "Process %u exiting", Core::CurrentProcess()->process_id);
491 492
492 ASSERT_MSG(g_current_process->status == ProcessStatus::Running, "Process has already exited"); 493 ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running,
494 "Process has already exited");
493 495
494 g_current_process->status = ProcessStatus::Exited; 496 Core::CurrentProcess()->status = ProcessStatus::Exited;
495 497
496 // Stop all the process threads that are currently waiting for objects. 498 // Stop all the process threads that are currently waiting for objects.
497 auto& thread_list = Core::System::GetInstance().Scheduler().GetThreadList(); 499 auto& thread_list = Core::System::GetInstance().Scheduler().GetThreadList();
498 for (auto& thread : thread_list) { 500 for (auto& thread : thread_list) {
499 if (thread->owner_process != g_current_process) 501 if (thread->owner_process != Core::CurrentProcess())
500 continue; 502 continue;
501 503
502 if (thread == GetCurrentThread()) 504 if (thread == GetCurrentThread())
@@ -525,14 +527,14 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
525 return ERR_OUT_OF_RANGE; 527 return ERR_OUT_OF_RANGE;
526 } 528 }
527 529
528 SharedPtr<ResourceLimit>& resource_limit = g_current_process->resource_limit; 530 SharedPtr<ResourceLimit>& resource_limit = Core::CurrentProcess()->resource_limit;
529 if (resource_limit->GetMaxResourceValue(ResourceTypes::PRIORITY) > priority) { 531 if (resource_limit->GetMaxResourceValue(ResourceTypes::PRIORITY) > priority) {
530 return ERR_NOT_AUTHORIZED; 532 return ERR_NOT_AUTHORIZED;
531 } 533 }
532 534
533 if (processor_id == THREADPROCESSORID_DEFAULT) { 535 if (processor_id == THREADPROCESSORID_DEFAULT) {
534 // Set the target CPU to the one specified in the process' exheader. 536 // Set the target CPU to the one specified in the process' exheader.
535 processor_id = g_current_process->ideal_processor; 537 processor_id = Core::CurrentProcess()->ideal_processor;
536 ASSERT(processor_id != THREADPROCESSORID_DEFAULT); 538 ASSERT(processor_id != THREADPROCESSORID_DEFAULT);
537 } 539 }
538 540
@@ -554,7 +556,7 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
554 556
555 CASCADE_RESULT(SharedPtr<Thread> thread, 557 CASCADE_RESULT(SharedPtr<Thread> thread,
556 Thread::Create(name, entry_point, priority, arg, processor_id, stack_top, 558 Thread::Create(name, entry_point, priority, arg, processor_id, stack_top,
557 g_current_process)); 559 Core::CurrentProcess()));
558 CASCADE_RESULT(thread->guest_handle, g_handle_table.Create(thread)); 560 CASCADE_RESULT(thread->guest_handle, g_handle_table.Create(thread));
559 *out_handle = thread->guest_handle; 561 *out_handle = thread->guest_handle;
560 562
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 25828777e..2394620eb 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -94,7 +94,7 @@ void Thread::Stop() {
94 u64 tls_page = (tls_address - Memory::TLS_AREA_VADDR) / Memory::PAGE_SIZE; 94 u64 tls_page = (tls_address - Memory::TLS_AREA_VADDR) / Memory::PAGE_SIZE;
95 u64 tls_slot = 95 u64 tls_slot =
96 ((tls_address - Memory::TLS_AREA_VADDR) % Memory::PAGE_SIZE) / Memory::TLS_ENTRY_SIZE; 96 ((tls_address - Memory::TLS_AREA_VADDR) % Memory::PAGE_SIZE) / Memory::TLS_ENTRY_SIZE;
97 Kernel::g_current_process->tls_slots[tls_page].reset(tls_slot); 97 Core::CurrentProcess()->tls_slots[tls_page].reset(tls_slot);
98} 98}
99 99
100void WaitCurrentThread_Sleep() { 100void WaitCurrentThread_Sleep() {
@@ -353,7 +353,7 @@ void Thread::BoostPriority(u32 priority) {
353SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority, 353SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority,
354 SharedPtr<Process> owner_process) { 354 SharedPtr<Process> owner_process) {
355 // Setup page table so we can write to memory 355 // Setup page table so we can write to memory
356 SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table); 356 SetCurrentPageTable(&Core::CurrentProcess()->vm_manager.page_table);
357 357
358 // Initialize new "main" thread 358 // Initialize new "main" thread
359 auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0, 359 auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0,