From 9c0ffd8fbbb8ca1fde5d7e114e26184c7ca6a580 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 6 Dec 2020 11:24:23 +0000 Subject: [PATCH] x86: fix conflicts with musl headers + freestanding adaptations --- arch/x86/defs.h | 38 ++++++++++++++++++++++++++++++++++++++ arch/x86/makecontext.c | 3 ++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/x86/defs.h b/arch/x86/defs.h index 63d2435..432ccc8 100644 --- a/arch/x86/defs.h +++ b/arch/x86/defs.h @@ -1,21 +1,59 @@ #ifndef __ARCH_X86_DEFS_H #define __ARCH_X86_DEFS_H +#ifndef _GNU_SOURCE #ifndef REG_GS # define REG_GS (0) +#endif + +#ifndef REG_FS # define REG_FS (1) +#endif + +#ifndef REG_ES # define REG_ES (2) +#endif + +#ifndef REG_DS # define REG_DS (3) +#endif + +#ifndef REG_EDI # define REG_EDI (4) +#endif + +#ifndef REG_ESI # define REG_ESI (5) +#endif + +#ifndef REG_EBP # define REG_EBP (6) +#endif + +#ifndef REG_ESP # define REG_ESP (7) +#endif + +#ifndef REG_EBX # define REG_EBX (8) +#endif + +#ifndef REG_EDX # define REG_EDX (9) +#endif + +#ifndef REG_ECX # define REG_ECX (10) +#endif + +#ifndef REG_EAX # define REG_EAX (11) +#endif + +#ifndef REG_EIP # define REG_EIP (14) #endif +#endif #define REG_SZ (4) diff --git a/arch/x86/makecontext.c b/arch/x86/makecontext.c index bad91f1..fc292f9 100644 --- a/arch/x86/makecontext.c +++ b/arch/x86/makecontext.c @@ -16,13 +16,14 @@ #include #include #include +#include "defs.h" extern void libucontext_trampoline(void); void -libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) +libucontext_makecontext(libucontext_ucontext_t *ucp, void (*func)(void), int argc, ...) { libucontext_greg_t *sp, *argp; va_list va;