Kernel: Add bareboness fork() function

This commit is contained in:
Bananymous
2023-05-28 18:08:26 +03:00
parent 3e93dae53c
commit f2d767b799
14 changed files with 125 additions and 44 deletions

View File

@@ -17,4 +17,8 @@
#define read_rsp(rsp) asm volatile("movl %%esp, %0" : "=r"(rsp))
#define push_callee_saved() asm volatile("pushal")
#define pop_callee_saved() asm volatile("popal")
#endif
#endif
#include <stdint.h>
extern "C" uintptr_t read_rip();

View File

@@ -41,6 +41,8 @@ namespace Kernel
pid_t pid() const { return m_pid; }
BAN::ErrorOr<Process*> fork(uintptr_t rsp, uintptr_t rip);
BAN::ErrorOr<int> open(BAN::StringView, int);
BAN::ErrorOr<void> close(int fd);
BAN::ErrorOr<size_t> read(int fd, void* buffer, size_t count);

View File

@@ -31,6 +31,8 @@ namespace Kernel
static BAN::ErrorOr<Thread*> create_userspace(uintptr_t, Process*, int, char**);
~Thread();
BAN::ErrorOr<Thread*> clone(Process*, uintptr_t rsp, uintptr_t rip);
pid_t tid() const { return m_tid; }
void set_rsp(uintptr_t rsp) { m_rsp = rsp; validate_stack(); }