diff options
| author | 2020-02-24 22:04:12 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:06 -0400 | |
| commit | e31425df3877636c098ec7426ebd2067920715cb (patch) | |
| tree | 5c0fc518a4ebb8413c491b43a9fdd99450c7bd80 /src/core/hle/kernel/process.cpp | |
| parent | Merge pull request #3396 from FernandoS27/prometheus-1 (diff) | |
| download | yuzu-e31425df3877636c098ec7426ebd2067920715cb.tar.gz yuzu-e31425df3877636c098ec7426ebd2067920715cb.tar.xz yuzu-e31425df3877636c098ec7426ebd2067920715cb.zip | |
General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and
Suspended State, Recreates the bootmanager, Initializes Multicore
system.
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index c4c5199b1..7e26a54f4 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -30,14 +30,15 @@ namespace { | |||
| 30 | /** | 30 | /** |
| 31 | * Sets up the primary application thread | 31 | * Sets up the primary application thread |
| 32 | * | 32 | * |
| 33 | * @param system The system instance to create the main thread under. | ||
| 33 | * @param owner_process The parent process for the main thread | 34 | * @param owner_process The parent process for the main thread |
| 34 | * @param kernel The kernel instance to create the main thread under. | ||
| 35 | * @param priority The priority to give the main thread | 35 | * @param priority The priority to give the main thread |
| 36 | */ | 36 | */ |
| 37 | void SetupMainThread(Process& owner_process, KernelCore& kernel, u32 priority, VAddr stack_top) { | 37 | void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) { |
| 38 | const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart(); | 38 | const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart(); |
| 39 | auto thread_res = Thread::Create(kernel, "main", entry_point, priority, 0, | 39 | ThreadType type = THREADTYPE_USER; |
| 40 | owner_process.GetIdealCore(), stack_top, owner_process); | 40 | auto thread_res = Thread::Create(system, type, "main", entry_point, priority, 0, |
| 41 | owner_process.GetIdealCore(), stack_top, &owner_process); | ||
| 41 | 42 | ||
| 42 | std::shared_ptr<Thread> thread = std::move(thread_res).Unwrap(); | 43 | std::shared_ptr<Thread> thread = std::move(thread_res).Unwrap(); |
| 43 | 44 | ||
| @@ -48,8 +49,12 @@ void SetupMainThread(Process& owner_process, KernelCore& kernel, u32 priority, V | |||
| 48 | thread->GetContext32().cpu_registers[1] = thread_handle; | 49 | thread->GetContext32().cpu_registers[1] = thread_handle; |
| 49 | thread->GetContext64().cpu_registers[1] = thread_handle; | 50 | thread->GetContext64().cpu_registers[1] = thread_handle; |
| 50 | 51 | ||
| 52 | auto& kernel = system.Kernel(); | ||
| 51 | // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires | 53 | // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires |
| 52 | thread->ResumeFromWait(); | 54 | { |
| 55 | SchedulerLock lock{kernel}; | ||
| 56 | thread->SetStatus(ThreadStatus::Ready); | ||
| 57 | } | ||
| 53 | } | 58 | } |
| 54 | } // Anonymous namespace | 59 | } // Anonymous namespace |
| 55 | 60 | ||
| @@ -294,7 +299,7 @@ void Process::Run(s32 main_thread_priority, u64 stack_size) { | |||
| 294 | 299 | ||
| 295 | ChangeStatus(ProcessStatus::Running); | 300 | ChangeStatus(ProcessStatus::Running); |
| 296 | 301 | ||
| 297 | SetupMainThread(*this, kernel, main_thread_priority, main_thread_stack_top); | 302 | SetupMainThread(system, *this, main_thread_priority, main_thread_stack_top); |
| 298 | resource_limit->Reserve(ResourceType::Threads, 1); | 303 | resource_limit->Reserve(ResourceType::Threads, 1); |
| 299 | resource_limit->Reserve(ResourceType::PhysicalMemory, main_thread_stack_size); | 304 | resource_limit->Reserve(ResourceType::PhysicalMemory, main_thread_stack_size); |
| 300 | } | 305 | } |