Manual process loading in C?
Posted: Thu Jan 07, 2016 2:51 pm
Hello, OSDev.org.
Recently I started working on a kernel that would be able to run in both freestanding and hosted environments. I want to manually load ELF files and build host processes from them. How can I do it? Is there any way to create a "blank" process and control its memory and machine state under UNIX/POSIX?
Google told me that I can use ptrace on a "dummy" process started by fork/execv/etc. Is it a good way? Is there something better? What about forking the kernel and replacing the forked process from inside?
Ideally, I would like a way that is supported by many platforms, but I'm also interested in system-specific paths too.
Recently I started working on a kernel that would be able to run in both freestanding and hosted environments. I want to manually load ELF files and build host processes from them. How can I do it? Is there any way to create a "blank" process and control its memory and machine state under UNIX/POSIX?
Google told me that I can use ptrace on a "dummy" process started by fork/execv/etc. Is it a good way? Is there something better? What about forking the kernel and replacing the forked process from inside?
Ideally, I would like a way that is supported by many platforms, but I'm also interested in system-specific paths too.