From 96e5d8dc99010e2cec8bd2edf59545bd13f6f769 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 28 May 2022 14:08:12 +0300 Subject: start implementing new proc/rpc handling + Essentially, separate root process and remote procedure call handling. I really should write down some documentation so I don't forget, but essentially: All threads share a common process virtual memory, and when a thread wants to make an rpc, it switches over to its own rpc vmem space that is linked to the remote process. --- common/elf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/elf.c') diff --git a/common/elf.c b/common/elf.c index b88be89..88c5ddc 100644 --- a/common/elf.c +++ b/common/elf.c @@ -7,6 +7,7 @@ #include #include #include +#include static uint8_t __elf_to_uvflags(uint8_t elf_flags) { @@ -27,6 +28,8 @@ static uint8_t __elf_to_uvflags(uint8_t elf_flags) static void __map_exec(struct tcb *t, vm_t bin, uint8_t ei_c, vm_t phstart, size_t phnum, size_t phsize) { + hard_assert(t && is_proc(t), RETURN_VOID); + /* TODO: take alignment into consideration? */ /* TODO: take overlapping memory regions into account, probably mostly * by keeping track of previously allocated area and seeing if the @@ -51,7 +54,7 @@ static void __map_exec(struct tcb *t, vm_t bin, uint8_t ei_c, vm_t phstart, uint8_t elf_flags = program_header_prop(ei_c, runner, p_flags); uint8_t uvflags = __elf_to_uvflags(elf_flags); - map_allocd_region(t->b_r, start, vsz, default_flags, 0); + map_allocd_region(t->proc.vmem, start, vsz, default_flags, 0); vm_t vo = bin + program_header_prop(ei_c, runner, p_offset); vm_t vfz = program_header_prop(ei_c, runner, p_filesz); -- cgit v1.3