From 5fc386102380e6c15c81df4fd750f54641535eaa Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Tue, 15 Feb 2022 15:00:53 +0000 Subject: beginning to things out into cpu-dependent and cpu-independent code --- kc/core/task.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'kc/core/task.c') diff --git a/kc/core/task.c b/kc/core/task.c index 09156d4..79fae5f 100644 --- a/kc/core/task.c +++ b/kc/core/task.c @@ -4,13 +4,12 @@ #include "panic.h" #include "cpu.h" #include "kprint.h" +#include "cpu/irq.h" struct kc_thread *current_task = NULL; struct kc_thread *first_ready_task = NULL; struct kc_thread *last_ready_task = NULL; -static int schedule_lock_cnt = 0; - static void lock_scheduler(void); static void unlock_scheduler(void); static void set_thread_status(enum kc_thread_status status); @@ -49,20 +48,12 @@ void task_schedule(void) static void lock_scheduler(void) { - __asm__ volatile ("cli;"); - schedule_lock_cnt++; + irq_lock(); } static void unlock_scheduler(void) { - if (schedule_lock_cnt >= 1) - { - schedule_lock_cnt--; - } - if (schedule_lock_cnt == 0) - { - __asm__ volatile ("sti;"); - } + irq_unlock(); } static void unblock_thread(struct kc_thread *thread) -- cgit v1.3.1-1-g115d