First Hello world syscall
All checks were successful
Build documentation / build-and-deploy (push) Successful in 26s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 26s
This commit is contained in:
@@ -108,25 +108,26 @@ static struct proc* proc_spawn_rd (char* name) {
|
||||
return proc_from_elf (rd_file->content);
|
||||
}
|
||||
|
||||
static void proc_register (struct proc* proc) {
|
||||
static void proc_register_for_cpu (struct proc* proc, struct cpu* cpu) {
|
||||
/* make available globally. */
|
||||
struct procw* procw = malloc (sizeof (*procw));
|
||||
if (procw == NULL)
|
||||
return;
|
||||
procw->proc = proc;
|
||||
proc->procw = procw;
|
||||
proc->cpu = cpu;
|
||||
|
||||
spin_lock (&procs_lock);
|
||||
|
||||
spin_lock (&thiscpu->lock);
|
||||
spin_lock (&cpu->lock);
|
||||
|
||||
linklist_append (struct procw*, procs, procw);
|
||||
linklist_append (struct proc*, thiscpu->proc_run_q, proc);
|
||||
linklist_append (struct proc*, cpu->proc_run_q, proc);
|
||||
|
||||
if (thiscpu->proc_current == NULL)
|
||||
thiscpu->proc_current = proc;
|
||||
if (cpu->proc_current == NULL)
|
||||
cpu->proc_current = proc;
|
||||
|
||||
spin_unlock (&thiscpu->lock);
|
||||
spin_unlock (&cpu->lock);
|
||||
|
||||
spin_unlock (&procs_lock);
|
||||
}
|
||||
@@ -170,9 +171,8 @@ void proc_sched (void) {
|
||||
|
||||
spin_unlock (&thiscpu->lock);
|
||||
|
||||
if (next != NULL && atomic_load (&next->state) == PROC_READY) {
|
||||
do_sched (&next->pdata.regs, &next->pd);
|
||||
}
|
||||
if (next != NULL && atomic_load (&next->state) == PROC_READY)
|
||||
do_sched (next);
|
||||
|
||||
idle:
|
||||
spin ();
|
||||
@@ -190,11 +190,11 @@ static void proc_irq_sched (void* arg, void* regs) {
|
||||
|
||||
void proc_init (void) {
|
||||
struct proc* init = proc_spawn_rd ("init.exe");
|
||||
proc_register (init);
|
||||
proc_register_for_cpu (init, thiscpu);
|
||||
|
||||
#if defined(__x86_64__)
|
||||
irq_attach (&proc_irq_sched, NULL, SCHED_PREEMPT_TIMER, 0);
|
||||
irq_attach (&proc_irq_sched, NULL, SCHED_PREEMPT_TIMER, IRQ_INTERRUPT_SAFE);
|
||||
#endif
|
||||
|
||||
do_sched (&init->pdata.regs, &init->pd);
|
||||
do_sched (init);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user