x86: fix conflicts with musl headers + freestanding adaptations

pull/21/head
Ariadne Conill 2020-12-06 11:24:23 +00:00
parent 83a109c2a7
commit 9c0ffd8fbb
2 changed files with 40 additions and 1 deletions

View File

@ -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)

View File

@ -16,13 +16,14 @@
#include <stdarg.h>
#include <string.h>
#include <stdint.h>
#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;