FORK problem
Posted: Sun May 25, 2003 8:51 am
Alright, I will try to make a long story short:
I've been implementing the FORK system call and I am currently debugging the do_fork() function.
This code does the following. At first the string "parent" is printed out as it should be. Next, the child process is picked to run and I get the "child" string on the screen. The problem is that the parent process is never picked up again. It's always the child who has the CPU. Besides, I get a "3rd (14) exception with no resolution" later on.
So I am asking you now if you have an idea what might be the bug. My procedure is simple: do_fork() copies the stack and creates a new context for the child. This context sets EBP to the parent's EBP and EIP to the function fork_out:
I attached the fork.c file, maybe you can have a look at it?
thanks and best regards,
Alexander
edit: Note that I didn't implement FORK as a system call yet, I am trying to debug the do_fork() function at first.
[attachment deleted by admin]
I've been implementing the FORK system call and I am currently debugging the do_fork() function.
Code: Select all
void init()
{
pid_t pid;
if ((pid = do_fork()) == -1) panic("FORK failed");
else if (pid > 0) { while(1) printf("parent\n"); }
while(1) printf("child\n");
}
So I am asking you now if you have an idea what might be the bug. My procedure is simple: do_fork() copies the stack and creates a new context for the child. This context sets EBP to the parent's EBP and EIP to the function fork_out:
Code: Select all
fork_out:
mov eax, 0
leave
ret
thanks and best regards,
Alexander
edit: Note that I didn't implement FORK as a system call yet, I am trying to debug the do_fork() function at first.
[attachment deleted by admin]