Kernel: We can create basic userspace processes
These are still allocated on the kernel memory
This commit is contained in:
@@ -23,9 +23,10 @@ namespace Kernel
|
||||
|
||||
public:
|
||||
static BAN::ErrorOr<BAN::RefPtr<Process>> create_kernel(entry_t, void*);
|
||||
static BAN::ErrorOr<BAN::RefPtr<Process>> create_userspace(void(*)());
|
||||
~Process();
|
||||
|
||||
void exit();
|
||||
[[noreturn]] void exit();
|
||||
|
||||
BAN::ErrorOr<Thread*> add_thread(entry_t, void*);
|
||||
void on_thread_exit(Thread&);
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#define SYS_TEST 0
|
||||
#define SYS_PUTC 1
|
||||
#define SYS_EXIT 1
|
||||
#define SYS_READ 2
|
||||
#define SYS_WRITE 3
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
template<typename T1 = void*, typename T2 = void*, typename T3 = void*>
|
||||
inline int syscall(int syscall, T1 arg1 = nullptr, T2 arg2 = nullptr, T3 arg3 = nullptr)
|
||||
{
|
||||
int ret;
|
||||
asm volatile("int $0x80" : "=a"(ret) : "a"(syscall), "b"((uintptr_t)arg1), "c"((uintptr_t)arg2), "d"((uintptr_t)arg3) : "memory");
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Kernel
|
||||
static BAN::ErrorOr<Thread*> create(entry_t, void* = nullptr, BAN::RefPtr<Process> = nullptr);
|
||||
~Thread();
|
||||
|
||||
void jump_userspace(uintptr_t rip);
|
||||
|
||||
pid_t tid() const { return m_tid; }
|
||||
|
||||
void set_rsp(uintptr_t rsp) { m_rsp = rsp; }
|
||||
|
||||
Reference in New Issue
Block a user