1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-10 06:01:52 +00:00

kern: minor fixes to prevent core0-2 panics during boot

This commit is contained in:
Michael Scire 2020-02-21 13:05:16 -08:00
parent bb3f7c8ab9
commit d2a888d9e8
5 changed files with 26 additions and 5 deletions

View file

@ -306,7 +306,7 @@ namespace ams::kern {
}
constexpr ALWAYS_INLINE Member *GetScheduledFront(s32 core, s32 priority) const {
return this->scheduled_queue.GetFront(core, priority);
return this->scheduled_queue.GetFront(priority, core);
}
constexpr ALWAYS_INLINE Member *GetSuggestedFront(s32 core) const {
@ -314,7 +314,7 @@ namespace ams::kern {
}
constexpr ALWAYS_INLINE Member *GetSuggestedFront(s32 core, s32 priority) const {
return this->suggested_queue.GetFront(core, priority);
return this->suggested_queue.GetFront(priority, core);
}
constexpr ALWAYS_INLINE Member *GetScheduledNext(s32 core, const Member *member) const {

View file

@ -88,7 +88,6 @@ namespace ams::kern {
static ALWAYS_INLINE void SetSchedulerUpdateNeeded() { s_scheduler_update_needed = true; }
static ALWAYS_INLINE void ClearSchedulerUpdateNeeded() { s_scheduler_update_needed = false; }
static ALWAYS_INLINE KSchedulerPriorityQueue &GetPriorityQueue() { return s_priority_queue; }
static NOINLINE void SetInterruptTaskThreadRunnable();
static NOINLINE u64 UpdateHighestPriorityThreadsImpl();
public:
@ -96,6 +95,8 @@ namespace ams::kern {
static ALWAYS_INLINE bool CanSchedule() { return GetCurrentThread().GetDisableDispatchCount() == 0; }
static ALWAYS_INLINE bool IsSchedulerLockedByCurrentThread() { return s_scheduler_lock.IsLockedByCurrentThread(); }
static NOINLINE void SetInterruptTaskThreadRunnable();
static ALWAYS_INLINE void DisableScheduling() {
MESOSPHERE_ASSERT(GetCurrentThread().GetDisableDispatchCount() >= 0);
GetCurrentThread().DisableDispatch();

View file

@ -345,6 +345,8 @@ namespace ams::kern {
}
}
void Wakeup();
Result SetPriorityToIdle();
Result Run();

View file

@ -89,7 +89,9 @@ namespace ams::kern {
void KInterruptTaskManager::EnqueueTask(KInterruptTask *task) {
MESOSPHERE_ASSERT(!KInterruptManager::AreInterruptsEnabled());
MESOSPHERE_TODO_IMPLEMENT();
/* Enqueue the task and signal the scheduler. */
this->task_queue.Enqueue(task);
Kernel::GetScheduler().SetInterruptTaskThreadRunnable();
}
}

View file

@ -260,8 +260,24 @@ namespace ams::kern {
return this->signaled;
}
void KThread::Wakeup() {
MESOSPHERE_ASSERT_THIS();
KScopedSchedulerLock sl;
if (this->GetState() == ThreadState_Waiting) {
if (this->sleeping_queue != nullptr) {
this->sleeping_queue->WakeupThread(this);
} else {
this->SetState(ThreadState_Runnable);
}
}
}
void KThread::OnTimer() {
MESOSPHERE_TODO_IMPLEMENT();
MESOSPHERE_ASSERT_THIS();
MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread());
this->Wakeup();
}
void KThread::DoWorkerTask() {