summaryrefslogtreecommitdiff
path: root/arch/x86_64/bits
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-11-23 14:35:25 -0500
committerRich Felker <dalias@aerifal.cx>2012-11-23 14:35:25 -0500
commitc72fc23843906e2571e817a62c94cee15648b7dc (patch)
tree539517daf0b9e34cba766a89d9775722456f5c41 /arch/x86_64/bits
parentac562aa1ef4012f617583f474a8d8e5c972ed6ee (diff)
downloadmusl-c72fc23843906e2571e817a62c94cee15648b7dc.tar.gz
sigcontext/mcontext cleanup for arch-specific bits
with these changes, the members/types of mcontext_t and related stuff should closely match the glibc definitions. unlike glibc, however, the definitions here avoid using typedefs as much as possible and work directly with the underlying types, to minimize namespace pollution from signal.h in the default (_BSD_SOURCE) profile. this is a first step in improving compatibility with applications which poke at context/register information -- mainly debuggers, trace utilities, etc. additional definitions in ucontext.h and other headers may be needed later. if feature test macros are used to request a conforming namespace, mcontext_t is replaced with an opaque structure of the equivalent size and alignment; conforming programs cannot examine its contents anyway.
Diffstat (limited to 'arch/x86_64/bits')
-rw-r--r--arch/x86_64/bits/signal.h49
1 files changed, 29 insertions, 20 deletions
diff --git a/arch/x86_64/bits/signal.h b/arch/x86_64/bits/signal.h
index d1de2dff..38f3bc42 100644
--- a/arch/x86_64/bits/signal.h
+++ b/arch/x86_64/bits/signal.h
@@ -1,17 +1,37 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-struct __fpstate {
- unsigned long __x[4];
- unsigned char __y[384];
- unsigned long __z[12];
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct _fpstate {
+ unsigned short cwd, swd, ftw, fop;
+ unsigned long long rip, rdp;
+ unsigned mxcsr, mxcr_mask;
+ struct {
+ unsigned short significand[4], exponent, padding[3];
+ } _st[8];
+ struct {
+ unsigned element[4];
+ } _xmm[16];
+ unsigned padding[24];
};
-
-typedef struct {
- unsigned long __gregs[23];
- void *__fpregs;
+struct sigcontext {
+ unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
+ unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
+ unsigned short cs, gs, fs, __pad0;
+ unsigned long err, trapno, oldmask, cr2;
+ struct _fpstate *fpstate;
unsigned long __reserved1[8];
+};
+typedef struct {
+ unsigned long long gregs[23];
+ struct _fpstate *fpregs;
+ unsigned long long __reserved1[8];
+} mcontext_t;
+#else
+typedef struct {
+ unsigned long __space[32];
} mcontext_t;
+#endif
typedef struct __ucontext {
unsigned long uc_flags;
@@ -19,7 +39,7 @@ typedef struct __ucontext {
stack_t uc_stack;
mcontext_t uc_mcontext;
sigset_t uc_sigmask;
- struct __fpstate __fpregs_mem;
+ unsigned long __fpregs_mem[64];
} ucontext_t;
#define SA_NOCLDSTOP 1
@@ -31,17 +51,6 @@ typedef struct __ucontext {
#define SA_RESETHAND 0x80000000
#define SA_RESTORER 0x04000000
-#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-struct sigcontext {
- unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
- unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
- unsigned short cs, gs, fs, __pad0;
- unsigned long err, trapno, oldmask, cr2;
- struct __fpstate *fpstate;
- unsigned long __reserved1[8];
-};
-#endif
-
#endif
#define SIGHUP 1