diff --git a/kernel/core/task.c b/kernel/core/task.c index 67f6f519..e2c51769 100644 --- a/kernel/core/task.c +++ b/kernel/core/task.c @@ -135,7 +135,7 @@ fork() { new_task->esp = esp + (new_task->stack - current_task->stack); new_task->ebp = ebp - (current_task->stack - new_task->stack); } - kprintf("old: %x new: %x; end: %x %x\n", esp, new_task->esp, current_task->stack, new_task->stack); + // kprintf("old: %x new: %x; end: %x %x\n", esp, new_task->esp, current_task->stack, new_task->stack); memcpy((void *)(new_task->stack - KERNEL_STACK_SIZE), (void *)(current_task->stack - KERNEL_STACK_SIZE), KERNEL_STACK_SIZE); new_task->eip = eip; __asm__ __volatile__ ("sti"); diff --git a/loader/sh.c b/loader/sh.c index 592853cb..f0062606 100644 --- a/loader/sh.c +++ b/loader/sh.c @@ -10,19 +10,21 @@ int main(int argc, char ** argv) { syscall_print(x); syscall_print("\n"); int i = syscall_getpid(); - syscall_fork(); - if (syscall_getpid() != i) { - syscall_print("Herp!\n"); - char * bin = "/bin/echo"; - char * args = "von derpington"; - char * argv_[] = { - bin, - args, - 0 - }; - syscall_execve(bin, argv_, 0); - } else { - syscall_print("Awe shucks\n"); + for (int j = 0; j < 5; ++j) { + syscall_fork(); + if (syscall_getpid() != i) { + syscall_print("[Forked]\n"); + char * bin = "/bin/echo"; + char * args = "Executed echo."; + char * argv_[] = { + bin, + args, + 0 + }; + syscall_execve(bin, argv_, 0); + } else { + syscall_print("(hello from parent)\n"); + } } return 0; }