kern: implement much of KScheduler, KHardwareTimer

This commit is contained in:
Michael Scire 2020-02-05 13:02:35 -08:00
parent 5e4307046a
commit 62de3322ff
19 changed files with 972 additions and 72 deletions

View file

@ -24,8 +24,8 @@ namespace ams::kern {
class KInterruptTaskManager;
struct KCurrentContext {
KThread *current_thread;
KProcess *current_process;
std::atomic<KThread *> current_thread;
std::atomic<KProcess *> current_process;
KScheduler *scheduler;
KInterruptTaskManager *interrupt_task_manager;
s32 core_id;
@ -43,7 +43,7 @@ namespace ams::kern {
}
ALWAYS_INLINE KThread *GetCurrentThreadPointer() {
return impl::GetCurrentContext().current_thread;
return impl::GetCurrentContext().current_thread.load(std::memory_order_relaxed);
}
ALWAYS_INLINE KThread &GetCurrentThread() {
@ -51,7 +51,7 @@ namespace ams::kern {
}
ALWAYS_INLINE KProcess *GetCurrentProcessPointer() {
return impl::GetCurrentContext().current_process;
return impl::GetCurrentContext().current_process.load(std::memory_order_relaxed);
}
ALWAYS_INLINE KProcess &GetCurrentProcess() {