Let the user application decide upon the resource ID (RID)
All checks were successful
Build documentation / build-and-deploy (push) Successful in 22s

This commit is contained in:
2026-01-14 23:19:39 +01:00
parent 7cd5623d36
commit ebd9f0cac6
8 changed files with 28 additions and 24 deletions

View File

@@ -144,6 +144,7 @@ struct elf_aux proc_load_segments (struct proc* proc, uint8_t* elf) {
aux.phent = ehdr->e_phentsize;
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
int rid_counter = 10;
for (uint64_t segment = 0; segment < ehdr->e_phnum; segment++) {
Elf64_Phdr* phdr =
@@ -159,10 +160,9 @@ struct elf_aux proc_load_segments (struct proc* proc, uint8_t* elf) {
size_t blks = div_align_up (phdr->p_memsz + off, PAGE_SIZE);
int rid = atomic_fetch_add (&proc->rids, 1);
struct proc_resource_mem_init mem_init = {.pages = blks};
struct proc_resource* r =
proc_create_resource (proc, rid, PR_MEM, RV_PRIVATE, (void*)&mem_init);
proc_create_resource (proc, rid_counter++, PR_MEM, RV_PRIVATE, (void*)&mem_init);
if (r == NULL) {
DEBUG ("pmm oom error while loading ELF segments! (tried to alloc %zu blks)\n", blks);
}