diff options
author | Marvin Borner | 2020-08-05 22:03:17 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-05 22:03:17 +0200 |
commit | 1272295d0c611f04128f9e388d5a0468dc64dae0 (patch) | |
tree | d596710ce147e36e07f427fda0ad5ecea31ee6d7 /src | |
parent | 835960fd85989ee961b5a932f467e6e4f545d201 (diff) |
I don't really know what's happening
Diffstat (limited to 'src')
-rw-r--r-- | src/features/proc.c | 23 | ||||
-rw-r--r-- | src/features/syscall.c | 1 | ||||
-rw-r--r-- | src/inc/proc.h | 1 |
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 |