mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
8accc92c3c
This is quite cool! The syscall entry point plumbs the register dump down to sys$fork(), which uses it to set up the child process's TSS in order to resume execution right after the int 0x80 fork() call. :^) This works pretty well, although there is some problem with the kernel alias mappings used to clone the parent process's regions. If I disable the MM::release_page_directory() code, there's no problem. Probably there's a premature freeing of a physical page somehow.
14 lines
276 B
C++
14 lines
276 B
C++
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
printf("Testing fork()...\n");
|
|
pid_t pid = fork();
|
|
if (!pid) {
|
|
printf("child, pid=%d\n", getpid());
|
|
} else {
|
|
printf("parent, child pid=%d\n", pid);
|
|
}
|
|
return 0;
|
|
}
|