Let the user application decide upon the resource ID (RID)
All checks were successful
Build documentation / build-and-deploy (push) Successful in 22s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 22s
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ struct proc {
|
||||
struct cpu* cpu;
|
||||
atomic_int state;
|
||||
struct rb_node_link* resource_tree;
|
||||
atomic_int rids;
|
||||
struct proc_suspension_q* suspension_q;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user