sched: irq: move all IRQs to new scheduling system
This commit is contained in:
parent
ce4c1aaf40
commit
6ad5fe88b2
2 changed files with 87 additions and 65 deletions
27
sched/proc.c
27
sched/proc.c
|
|
@ -8,7 +8,7 @@
|
|||
static struct rbtree *proc_tree;
|
||||
static pid_t *proc_current;
|
||||
|
||||
void return_to_user(struct procregs *regs, paddr_t cr3);
|
||||
void _return_to_user(struct procregs *regs, paddr_t cr3);
|
||||
|
||||
struct procregs *proc_current_regs()
|
||||
{
|
||||
|
|
@ -23,6 +23,31 @@ struct procregs *proc_current_regs()
|
|||
}
|
||||
}
|
||||
|
||||
struct proc *proc_find(pid_t pid)
|
||||
{
|
||||
struct rbnode *proc_node = rbt_search(proc_tree, pid);
|
||||
|
||||
if (proc_node) {
|
||||
return (void *)proc_node->value;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void schedule()
|
||||
{
|
||||
uint8_t id = lapic_idno();
|
||||
|
||||
struct proc *proc = proc_find(proc_current[id]);
|
||||
|
||||
if(proc) {
|
||||
_return_to_user(&proc->regs, proc->cr3);
|
||||
} else {
|
||||
kprintf(LOG_ERROR "proc: schedule: proc_current[%u] is NULL\n", id);
|
||||
panic();
|
||||
}
|
||||
}
|
||||
|
||||
void proc_init(unsigned num_cpus)
|
||||
{
|
||||
/* allocate current process structs */
|
||||
|
|
|
|||
Loading…
Reference in a new issue