mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 12:21:18 +00:00
kern: fix kscheduler interrupt api, adjust debug logging
This commit is contained in:
parent
fae2daf77c
commit
5fa59ec888
6 changed files with 18 additions and 8 deletions
|
@ -70,6 +70,11 @@ namespace ams::kern {
|
|||
NOINLINE void Initialize(KThread *idle_thread);
|
||||
NOINLINE void Activate();
|
||||
|
||||
ALWAYS_INLINE void SetInterruptTaskRunnable() {
|
||||
this->state.interrupt_task_thread_runnable = true;
|
||||
this->state.needs_scheduling = true;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void RequestScheduleOnInterrupt() {
|
||||
SetSchedulerUpdateNeeded();
|
||||
|
||||
|
@ -85,13 +90,13 @@ namespace ams::kern {
|
|||
static ALWAYS_INLINE KSchedulerPriorityQueue &GetPriorityQueue() { return s_priority_queue; }
|
||||
|
||||
static NOINLINE u64 UpdateHighestPriorityThreadsImpl();
|
||||
|
||||
static NOINLINE void InterruptTaskThreadToRunnable();
|
||||
public:
|
||||
/* Static public API. */
|
||||
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();
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace ams::kern::arch::arm64 {
|
|||
KProcess *cur_process = GetCurrentProcessPointer();
|
||||
bool should_process_user_exception = KTargetSystem::IsUserExceptionHandlersEnabled();
|
||||
|
||||
MESOSPHERE_LOG("User Exception occurred in %s\n", cur_process->GetName());
|
||||
|
||||
const u64 ec = (esr >> 26) & 0x3F;
|
||||
switch (ec) {
|
||||
case 0x0: /* Unknown */
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace ams::kern {
|
|||
|
||||
/* Enqueue the task and signal the scheduler. */
|
||||
this->task_queue.Enqueue(task);
|
||||
Kernel::GetScheduler().SetInterruptTaskThreadRunnable();
|
||||
Kernel::GetScheduler().SetInterruptTaskRunnable();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ namespace ams::kern {
|
|||
return cores_needing_scheduling;
|
||||
}
|
||||
|
||||
void KScheduler::SetInterruptTaskThreadRunnable() {
|
||||
void KScheduler::InterruptTaskThreadToRunnable() {
|
||||
MESOSPHERE_ASSERT(GetCurrentThread().GetDisableDispatchCount() == 1);
|
||||
|
||||
KThread *task_thread = Kernel::GetInterruptTaskManager().GetThread();
|
||||
|
@ -252,7 +252,7 @@ namespace ams::kern {
|
|||
|
||||
/* Switch the current process, if we're switching processes. */
|
||||
if (KProcess *next_process = next_thread->GetOwnerProcess(); next_process != cur_process) {
|
||||
MESOSPHERE_LOG("!!! PROCESS SWITCH !!! %s -> %s\n", cur_process != nullptr ? cur_process->GetName() : nullptr, next_process != nullptr ? next_process->GetName() : nullptr);
|
||||
/* MESOSPHERE_LOG("!!! PROCESS SWITCH !!! %s -> %s\n", cur_process != nullptr ? cur_process->GetName() : nullptr, next_process != nullptr ? next_process->GetName() : nullptr); */
|
||||
KProcess::Switch(cur_process, next_process);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,9 @@ namespace ams::kern {
|
|||
::std::va_list vl;
|
||||
va_start(vl, format);
|
||||
MESOSPHERE_RELEASE_LOG("Core[%d]: Kernel Panic at %s:%d\n", GetCurrentCoreId(), file, line);
|
||||
if (KProcess *cur_process = GetCurrentProcessPointer(); cur_process != nullptr) {
|
||||
MESOSPHERE_RELEASE_LOG("Core[%d]: Current Process: %s\n", GetCurrentCoreId(), cur_process->GetName());
|
||||
}
|
||||
MESOSPHERE_RELEASE_VLOG(format, vl);
|
||||
MESOSPHERE_RELEASE_LOG("\n");
|
||||
va_end(vl);
|
||||
|
|
|
@ -115,10 +115,10 @@ _ZN3ams4kern10KScheduler12ScheduleImplEv:
|
|||
ldrb w3, [x1, #1]
|
||||
cbz w3, 0f
|
||||
|
||||
/* If it is, we want to call KScheduler::SetInterruptTaskThreadRunnable() to note it runnable. */
|
||||
/* If it is, we want to call KScheduler::InterruptTaskThreadToRunnable() to change its state to runnable. */
|
||||
stp x0, x1, [sp, #-16]!
|
||||
stp x30, xzr, [sp, #-16]!
|
||||
bl _ZN3ams4kern10KScheduler30SetInterruptTaskThreadRunnableEv
|
||||
bl _ZN3ams4kern10KScheduler29InterruptTaskThreadToRunnableEv
|
||||
ldp x30, xzr, [sp], 16
|
||||
ldp x0, x1, [sp], 16
|
||||
|
||||
|
@ -271,7 +271,7 @@ _ZN3ams4kern10KScheduler12ScheduleImplEv:
|
|||
cbz w3, 4b
|
||||
|
||||
/* It does, so do so. We're using the idle thread stack so no register state preserve needed. */
|
||||
bl _ZN3ams4kern10KScheduler30SetInterruptTaskThreadRunnableEv
|
||||
bl _ZN3ams4kern10KScheduler29InterruptTaskThreadToRunnableEv
|
||||
|
||||
/* Clear the interrupt task thread as runnable. */
|
||||
strb wzr, [x20, #1]
|
||||
|
|
Loading…
Reference in a new issue