From c489b2e5f072d73d0cf17d555c6483da55718235 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 17 Mar 2024 23:48:03 -0400 Subject: kernel: loader: Keep track of program addr range Signed-off-by: Ian Moffett --- sys/include/sys/loader.h | 3 ++- sys/include/sys/proc.h | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'sys/include') diff --git a/sys/include/sys/loader.h b/sys/include/sys/loader.h index 74a325c..b1f06c1 100644 --- a/sys/include/sys/loader.h +++ b/sys/include/sys/loader.h @@ -32,6 +32,7 @@ #include #include +#include /* DANGER!: DO NOT CHANGE THESE DEFINES */ #define AT_NULL 0 @@ -61,7 +62,7 @@ struct auxval { #if defined(_KERNEL) int loader_load(struct vas vas, const void *dataptr, struct auxval *auxv, - size_t load_base, char **ld_path); + size_t load_base, char **ld_path, struct vm_range *prog_range); #endif /* defined(_KERNEL) */ #endif /* !_SYS_LOADER_H_ */ diff --git a/sys/include/sys/proc.h b/sys/include/sys/proc.h index c6046d7..75a5c1b 100644 --- a/sys/include/sys/proc.h +++ b/sys/include/sys/proc.h @@ -39,6 +39,12 @@ #include #define PROC_MAX_FDS 256 +#define PROC_MAX_ADDR_RANGE 4 + +enum { + ADDR_RANGE_EXEC = 0, /* Program address range */ + ADDR_RANGE_STACK /* Stack address range */ +}; /* * A task running on the CPU e.g., a process or @@ -50,7 +56,7 @@ struct proc { struct trapframe *tf; struct pcb pcb; struct vas addrsp; - uintptr_t stack_base; + struct vm_range addr_range[PROC_MAX_ADDR_RANGE]; uint8_t is_user; struct filedesc *fds[PROC_MAX_FDS]; TAILQ_ENTRY(proc) link; -- cgit v1.2.3