Fix fork() for new task switching model

This commit is contained in:
Justin C. Miller
2019-04-03 10:08:26 -07:00
parent 8375870af6
commit c605793a9d
13 changed files with 172 additions and 97 deletions

View File

@@ -71,10 +71,9 @@ struct process
void exit(unsigned code);
/// Copy this process.
/// \arg regs The saved state from the fork syscall
/// \returns Returns the child's pid to the parent, and
/// 0 to the child.
pid_t fork(cpu_state *regs);
pid_t fork();
/// Unready this process until it gets a signal
/// \arg sigmask A bitfield of signals to wake on
@@ -135,6 +134,11 @@ private:
/// process object, but also returns it.
/// \returns The new rsp0 as a pointer
void * setup_kernel_stack();
/// Initialize this process' kenrel stack with a fake return segment for
/// returning out of task_switch.
/// \arg rip The rip to return to
void add_fake_task_return(uintptr_t rip);
};
using process_list = kutil::linked_list<process>;