Kernel/LibC/DynamicLoader: Update process start ABI

We now use SysV abi for process startup
This commit is contained in:
2025-04-15 23:04:20 +03:00
parent e6026cb0b8
commit 36baf7b0af
12 changed files with 314 additions and 280 deletions

View File

@@ -34,15 +34,6 @@ namespace Kernel
public:
using entry_t = Thread::entry_t;
struct userspace_info_t
{
uintptr_t entry { 0 };
int argc { 0 };
char** argv { nullptr };
char** envp { nullptr };
int file_fd { -1 };
};
public:
static Process* create_kernel();
static Process* create_kernel(entry_t, void*);
@@ -183,7 +174,7 @@ namespace Kernel
BAN::ErrorOr<long> sys_sigprocmask(int how, const sigset_t* set, sigset_t* oset);
BAN::ErrorOr<long> sys_yield();
BAN::ErrorOr<long> sys_pthread_create(const pthread_attr_t* __restrict attr, void (*entry)(void*), void* arg);
BAN::ErrorOr<long> sys_pthread_create(const pthread_attr_t* attr, void (*entry)(void*), void* arg);
BAN::ErrorOr<long> sys_pthread_exit(void* value);
BAN::ErrorOr<long> sys_pthread_join(pthread_t thread, void** value);
BAN::ErrorOr<long> sys_pthread_self();
@@ -208,7 +199,6 @@ namespace Kernel
size_t proc_environ(off_t offset, BAN::ByteSpan) const;
bool is_userspace() const { return m_is_userspace; }
const userspace_info_t& userspace_info() const { return m_userspace_info; }
// Returns error if page could not be allocated
// Returns true if the page was allocated successfully
@@ -315,7 +305,6 @@ namespace Kernel
BAN::Vector<BAN::String> m_environ;
bool m_is_userspace { false };
userspace_info_t m_userspace_info;
SpinLock m_child_exit_lock;
BAN::Vector<ChildExitStatus> m_child_exit_statuses;

View File

@@ -7,6 +7,8 @@
#include <kernel/Memory/VirtualRange.h>
#include <kernel/ThreadBlocker.h>
#include <LibELF/AuxiliaryVector.h>
#include <signal.h>
#include <sys/types.h>
@@ -41,9 +43,10 @@ namespace Kernel
BAN::ErrorOr<Thread*> pthread_create(entry_t, void*);
BAN::ErrorOr<Thread*> clone(Process*, uintptr_t sp, uintptr_t ip);
void setup_exec();
void setup_process_cleanup();
BAN::ErrorOr<void> initialize_userspace(vaddr_t entry, BAN::Span<BAN::String> argv, BAN::Span<BAN::String> envp, BAN::Span<LibELF::AuxiliaryVector> auxv);
// Returns true, if thread is going to trigger signal
bool is_interrupted_by_signal() const;
@@ -100,7 +103,7 @@ namespace Kernel
private:
Thread(pid_t tid, Process*);
void setup_exec_impl(uintptr_t entry, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3);
void setup_exec(vaddr_t ip, vaddr_t sp);
static void on_exit_trampoline(Thread*);
void on_exit();