From 9ea4f985a53a893d3a125dad776905f04905151d Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 22 Apr 2024 20:17:44 -0400 Subject: kernel: auxv: Add AT_PAGESIZE Signed-off-by: Ian Moffett --- lib/libc/include/sys/auxv.h | 3 ++- sys/include/sys/loader.h | 1 + sys/kern/kern_sched.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libc/include/sys/auxv.h b/lib/libc/include/sys/auxv.h index b06d01c..a776e05 100644 --- a/lib/libc/include/sys/auxv.h +++ b/lib/libc/include/sys/auxv.h @@ -41,8 +41,9 @@ #define AT_SECURE 6 #define AT_RANDOM 7 #define AT_EXECFN 8 +#define AT_PAGESIZE 9 -#define AT_MAX_COUNT 9 +#define AT_MAX_COUNT 10 struct auxv_entry { uint64_t tag; diff --git a/sys/include/sys/loader.h b/sys/include/sys/loader.h index b1f06c1..297c18d 100644 --- a/sys/include/sys/loader.h +++ b/sys/include/sys/loader.h @@ -44,6 +44,7 @@ #define AT_SECURE 6 #define AT_RANDOM 7 #define AT_EXECFN 8 +#define AT_PAGESIZE 9 #define STACK_PUSH(ptr, val) *(--ptr) = val #define AUXVAL(ptr, tag, val) __extension__ ({ \ diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 9551265..a8aa23c 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -179,6 +179,7 @@ sched_init_stack(void *stack_top, char *argvp[], char *envp[], struct auxval aux AUXVAL(sp, AT_ENTRY, auxv.at_entry); AUXVAL(sp, AT_PHDR, auxv.at_phdr); AUXVAL(sp, AT_PHNUM, auxv.at_phnum); + AUXVAL(sp, AT_PAGESIZE, vm_get_page_size()); STACK_PUSH(sp, 0); /* Copy envp pointers */ -- cgit v1.2.3