summaryrefslogtreecommitdiff
path: root/kc/core/task.c
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2023-02-14 15:14:35 +0000
committerAda Christine <adachristine18@gmail.com>2023-02-14 15:14:35 +0000
commit9fd358e9395aae73622bdcf58ebe43f12671c990 (patch)
treeb9bd20fba6ee4a7da84d54d2208e17a49c0305d5 /kc/core/task.c
parentf59e168c504f50de7b2ff77af0c1b1cfe0483e7b (diff)
refactors
Diffstat (limited to 'kc/core/task.c')
-rw-r--r--kc/core/task.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kc/core/task.c b/kc/core/task.c
index 6c73f89..3e0288d 100644
--- a/kc/core/task.c
+++ b/kc/core/task.c
@@ -61,6 +61,8 @@ static void idle_thread_entry(void)
{
kprintf("idle thread started\n");
unlock_scheduler();
+
+ __asm__ ("sti");
while (true)
{
@@ -171,20 +173,22 @@ void task_schedule(void)
}
}
+static uint64_t scheduler_flags;
+
static void lock_scheduler(void)
{
- irq_lock();
+ scheduler_flags = irq_lock();
}
static void lock_preempt(void)
{
- irq_lock();
+ scheduler_flags = irq_lock();
preempt_switch_count++;
}
static void unlock_scheduler(void)
{
- irq_unlock();
+ irq_unlock(scheduler_flags);
}
static void unlock_preempt(void)
@@ -201,7 +205,7 @@ static void unlock_preempt(void)
task_schedule();
}
- irq_unlock();
+ irq_unlock(scheduler_flags);
}
void update_time(void)