From da813b4d95c5b2df34b4da3ff4448a284317d2e2 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Wed, 15 Apr 2020 20:19:59 +0000 Subject: [PATCH] Introduce an AUXARGS_ENTRY_PTR() macro. As the name implys, it uses the a_ptr member of the auxarg entry (except in compat32 where it uses a_val). This is more correct and required for systems where a_val is not the same size or hardware type as a_ptr (e.g. CHERI). This is a prepratory commit for D24407. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA --- sys/sys/imgact_elf.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h index 1023b3c829c..960b0fa48e7 100644 --- a/sys/sys/imgact_elf.h +++ b/sys/sys/imgact_elf.h @@ -39,6 +39,13 @@ #define AUXARGS_ENTRY(pos, id, val) \ {(pos)->a_type = (id); (pos)->a_un.a_val = (val); (pos)++;} +#if (defined(__LP64__) && __ELF_WORD_SIZE == 32) +#define AUXARGS_ENTRY_PTR(pos, id, ptr) \ + {(pos)->a_type = (id); (pos)->a_un.a_val = (uintptr_t)(ptr); (pos)++;} +#else +#define AUXARGS_ENTRY_PTR(pos, id, ptr) \ + {(pos)->a_type = (id); (pos)->a_un.a_ptr = (ptr); (pos)++;} +#endif struct image_params; struct thread;