x86_64: define reg names if not defined

_GNU_SOURCE can be defined without defining REG_X macros so it is not a
good indicator. (QEMU for example defines it in the build system.) x86
and x86_64 should have consistant looking defs.h so ifndef guards are
added to each REG_X definition.
arm_linker_fix
osy 2021-03-08 14:02:58 -08:00
parent f3e1b876c7
commit 5d66c194a7
2 changed files with 67 additions and 3 deletions

View File

@ -1,7 +1,6 @@
#ifndef __ARCH_X86_DEFS_H #ifndef __ARCH_X86_DEFS_H
#define __ARCH_X86_DEFS_H #define __ARCH_X86_DEFS_H
#ifndef _GNU_SOURCE
#ifndef REG_GS #ifndef REG_GS
# define REG_GS (0) # define REG_GS (0)
#endif #endif
@ -53,7 +52,6 @@
#ifndef REG_EIP #ifndef REG_EIP
# define REG_EIP (14) # define REG_EIP (14)
#endif #endif
#endif
#define REG_SZ (4) #define REG_SZ (4)

View File

@ -1,29 +1,95 @@
#ifndef __ARCH_X86_64_DEFS_H #ifndef __ARCH_X86_64_DEFS_H
#define __ARCH_X86_64_DEFS_H #define __ARCH_X86_64_DEFS_H
#ifndef _GNU_SOURCE #ifndef REG_R8
# define REG_R8 (0) # define REG_R8 (0)
#endif
#ifndef REG_R9
# define REG_R9 (1) # define REG_R9 (1)
#endif
#ifndef REG_R10
# define REG_R10 (2) # define REG_R10 (2)
#endif
#ifndef REG_R11
# define REG_R11 (3) # define REG_R11 (3)
#endif
#ifndef REG_R12
# define REG_R12 (4) # define REG_R12 (4)
#endif
#ifndef REG_R13
# define REG_R13 (5) # define REG_R13 (5)
#endif
#ifndef REG_R14
# define REG_R14 (6) # define REG_R14 (6)
#endif
#ifndef REG_R15
# define REG_R15 (7) # define REG_R15 (7)
#endif
#ifndef REG_RDI
# define REG_RDI (8) # define REG_RDI (8)
#endif
#ifndef REG_RSI
# define REG_RSI (9) # define REG_RSI (9)
#endif
#ifndef REG_RBP
# define REG_RBP (10) # define REG_RBP (10)
#endif
#ifndef REG_RBX
# define REG_RBX (11) # define REG_RBX (11)
#endif
#ifndef REG_RDX
# define REG_RDX (12) # define REG_RDX (12)
#endif
#ifndef REG_RAX
# define REG_RAX (13) # define REG_RAX (13)
#endif
#ifndef REG_RCX
# define REG_RCX (14) # define REG_RCX (14)
#endif
#ifndef REG_RSP
# define REG_RSP (15) # define REG_RSP (15)
#endif
#ifndef REG_RIP
# define REG_RIP (16) # define REG_RIP (16)
#endif
#ifndef REG_EFL
# define REG_EFL (17) # define REG_EFL (17)
#endif
#ifndef REG_CSGSFS
# define REG_CSGSFS (18) # define REG_CSGSFS (18)
#endif
#ifndef REG_ERR
# define REG_ERR (19) # define REG_ERR (19)
#endif
#ifndef REG_TRAPNO
# define REG_TRAPNO (20) # define REG_TRAPNO (20)
#endif
#ifndef REG_OLDMASK
# define REG_OLDMASK (21) # define REG_OLDMASK (21)
#endif
#ifndef REG_CR2
# define REG_CR2 (22) # define REG_CR2 (22)
#endif #endif