aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/features/proc.c23
-rw-r--r--src/features/syscall.c1
-rw-r--r--src/inc/proc.h1
3 files changed, 16 insertions, 9 deletions
diff --git a/src/features/proc.c b/src/features/proc.c
index d0fd66c..0378183 100644
--- a/src/features/proc.c
+++ b/src/features/proc.c
@@ -69,19 +69,24 @@ struct proc *proc_make()
return proc;
}
+void proc_jump(struct proc *proc)
+{
+ void (*entry)();
+ *(void **)(&entry) = (u32 *)proc->regs.eip;
+ __asm__ volatile("movl %%eax, %%ebp" ::"a"(proc->regs.ebp));
+ __asm__ volatile("movl %%eax, %%esp" ::"a"(proc->regs.esp));
+ current = proc;
+ sti();
+ entry();
+}
+
void proc_init()
{
cli();
+ irq_install_handler(0, scheduler);
+
current = root = proc_make();
bin_load("/init", root);
- irq_install_handler(0, scheduler);
proc_print();
-
- // JUMP!
- void (*entry)();
- *(void **)(&entry) = (u32 *)root->regs.eip;
- __asm__ volatile("movl %%eax, %%ebp" ::"a"(root->regs.ebp));
- __asm__ volatile("movl %%eax, %%esp" ::"a"(root->regs.esp));
- sti();
- entry();
+ proc_jump(root);
}
diff --git a/src/features/syscall.c b/src/features/syscall.c
index 50963b7..ebfff59 100644
--- a/src/features/syscall.c
+++ b/src/features/syscall.c
@@ -11,6 +11,7 @@ void syscall_handler(struct regs *r)
struct proc *a = proc_make();
bin_load("/a", a);
+ proc_jump(a);
}
void syscall_init()
diff --git a/src/inc/proc.h b/src/inc/proc.h
index dc8b9e9..bc3d115 100644
--- a/src/inc/proc.h
+++ b/src/inc/proc.h
@@ -17,6 +17,7 @@ struct proc {
};
void proc_init();
+void proc_jump(struct proc *proc);
struct proc *proc_make();
#endif