sched: add current_task(), current_thread(), and preempt_disable/enable()
This commit is contained in:
38
sched/core.c
Normal file
38
sched/core.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <socks/object.h>
|
||||
#include <socks/sched.h>
|
||||
#include <socks/cpu.h>
|
||||
#include <socks/printk.h>
|
||||
|
||||
extern kern_status_t setup_kernel_task(void);
|
||||
extern kern_status_t task_object_type_init(void);
|
||||
extern kern_status_t thread_object_type_init(void);
|
||||
|
||||
kern_status_t sched_init(void)
|
||||
{
|
||||
kern_status_t status = KERN_OK;
|
||||
|
||||
status = task_object_type_init();
|
||||
if (status != KERN_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = thread_object_type_init();
|
||||
if (status != KERN_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = setup_kernel_task();
|
||||
if (status != KERN_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
thread_t *this_thread = QUEUE_CONTAINER(thread_t, tr_threads, queue_first(&kernel_task()->t_threads));
|
||||
|
||||
cpu_data_t *this_cpu = get_this_cpu();
|
||||
runqueue_init(&this_cpu->c_rq);
|
||||
this_cpu->c_current_thread = this_thread;
|
||||
put_cpu(this_cpu);
|
||||
|
||||
printk("sched: initialised");
|
||||
return status;
|
||||
}
|
||||
Reference in New Issue
Block a user