aboutsummaryrefslogtreecommitdiff
path: root/common/elf.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-05-28 14:08:12 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-05-28 14:08:12 +0300
commit96e5d8dc99010e2cec8bd2edf59545bd13f6f769 (patch)
treebd3e5433c042c28707ec787cd6a133e6307d3e51 /common/elf.c
parentc5ce4978958762849083143d1fcbe694b44b5c51 (diff)
downloadkmi-96e5d8dc99010e2cec8bd2edf59545bd13f6f769.tar.gz
kmi-96e5d8dc99010e2cec8bd2edf59545bd13f6f769.zip
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.
Diffstat (limited to 'common/elf.c')
-rw-r--r--common/elf.c5
1 files changed, 4 insertions, 1 deletions
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 <apos/vmem.h>
#include <apos/bits.h>
#include <apos/string.h>
+#include <apos/assert.h>
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);