kernel: ldt support

This commit is contained in:
Matheus
2026-03-20 21:23:59 -03:00
parent a73c82f912
commit 41f97c6c61
17 changed files with 315 additions and 94 deletions
+3
View File
@@ -131,6 +131,9 @@ proc_t *proc_create() {
}
void proc_destroy(proc_t *proc) {
#ifdef __x86_64__
if (proc->ldt) free(proc->ldt);
#endif
free(proc->fd);
slab_free(processcache, proc);
}
+10
View File
@@ -6,6 +6,7 @@
#include <kernel/jobctl.h>
#include <kernel/interrupt.h>
#include <arch/cpu.h>
#include <logging.h>
syscallret_t syscall_fork(context_t *ctx) {
syscallret_t ret = {
@@ -37,6 +38,14 @@ syscallret_t syscall_fork(context_t *ctx) {
if (ret.errno)
goto cleanup;
#ifdef __x86_64__
if (proc->ldt) {
ret.errno = arch_ldt_fork(&nproc->ldt, proc->ldt);
if (ret.errno)
goto cleanup;
}
#endif
MUTEX_ACQUIRE(&proc->mutex);
nproc->parent = proc;
@@ -80,5 +89,6 @@ syscallret_t syscall_fork(context_t *ctx) {
PROC_RELEASE(nproc);
cleanup:
// XXX no cleanup, TODO
return ret;
}