Implement passing commandline strings
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 1m37s
Build documentation / build-and-deploy (push) Successful in 1m42s

This commit is contained in:
2026-04-28 19:48:34 +02:00
parent 347fe0a49d
commit 9fbe23024c
9 changed files with 51 additions and 7 deletions

View File

@@ -3,6 +3,7 @@
#include <libk/rbtree.h>
#include <libk/std.h>
#include <libk/string.h>
#include <limine/requests.h>
#include <mm/malloc.h>
#include <mm/pmm.h>
#include <proc/env.h>
@@ -132,6 +133,8 @@ bool procgroup_unmap(struct procgroup* procgroup, uintptr_t start_vaddr, size_t
}
struct procgroup* procgroup_create(void) {
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
struct procgroup* procgroup = malloc(sizeof(*procgroup));
if (procgroup == NULL) {
return NULL;
@@ -156,6 +159,10 @@ struct procgroup* procgroup_create(void) {
procgroup->pd.cr3_paddr = mm_alloc_user_pd_phys();
procgroup->map_base = PROC_MAP_BASE;
procgroup->uvaddr_cmdline = procgroup_map(procgroup, PROC_CMDLINE_BASE, 1,
MM_PG_PRESENT | MM_PG_USER, &procgroup->paddr_cmdline);
memset((void*)((uintptr_t)hhdm->offset + procgroup->paddr_cmdline), 0, PROCGROUP_CMDLINE_MAX);
if (proc_create_resource_mail(procgroup) == NULL) {
id_alloc_fini(&procgroup->rid_alloc);
free(procgroup);
@@ -214,6 +221,8 @@ static void procgroup_delete(struct procgroup* procgroup, struct reschedule_ctx*
proc_env_cleanup(procgroup);
pmm_free(procgroup->paddr_cmdline, 1);
pmm_free(procgroup->pd.cr3_paddr, 1);
free(procgroup->tls.tls_tmpl);

View File

@@ -5,14 +5,15 @@
#include <libk/list.h>
#include <libk/rbtree.h>
#include <libk/std.h>
#include <page_size.h>
#include <proc/env.h>
#include <proc/resource.h>
#include <sync/spin_lock.h>
#include <sys/mm.h>
#include <sys/procgroup.h>
#define PROCGROUP_VFS_HANDLES_MAX 256
#define PROCGROUP_RESOURCES_MAX 256
#define PROCGROUP_RESOURCES_MAX 256
#define PROCGROUP_CMDLINE_MAX PAGE_SIZE
struct proc;
struct reschedule_ctx;
@@ -36,6 +37,8 @@ struct procgroup {
uintptr_t map_base;
struct procgroup_tls tls;
struct proc_env env;
uintptr_t uvaddr_cmdline;
uintptr_t paddr_cmdline;
};
struct procgroup* procgroup_create(void);