summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-11-25 23:04:23 -0500
committerRich Felker <dalias@aerifal.cx>2012-11-25 23:04:23 -0500
commita8da6c2f287037cbacc65578a268f355760eaf8e (patch)
treee325def382b70f767adfa8ac844ee899936eacf4
parent4b75f4ed8d08b26d4bf2ac96191b395218ad888e (diff)
downloadmusl-a8da6c2f287037cbacc65578a268f355760eaf8e.tar.gz
musl-a8da6c2f287037cbacc65578a268f355760eaf8e.tar.bz2
musl-a8da6c2f287037cbacc65578a268f355760eaf8e.tar.xz
musl-a8da6c2f287037cbacc65578a268f355760eaf8e.zip
fixup mcontext stuff to expost gregset_t/fpregset_t as appropriate
-rw-r--r--arch/arm/bits/signal.h1
-rw-r--r--arch/i386/bits/signal.h9
-rw-r--r--arch/microblaze/bits/signal.h1
-rw-r--r--arch/mips/bits/signal.h20
-rw-r--r--arch/powerpc/bits/signal.h2
-rw-r--r--arch/x86_64/bits/signal.h9
-rw-r--r--include/signal.h1
-rw-r--r--include/ucontext.h4
8 files changed, 35 insertions, 12 deletions
diff --git a/arch/arm/bits/signal.h b/arch/arm/bits/signal.h
index 190b1d63..fd36bc78 100644
--- a/arch/arm/bits/signal.h
+++ b/arch/arm/bits/signal.h
@@ -2,6 +2,7 @@
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef int greg_t, gregset_t[18];
typedef struct sigcontext
{
unsigned long trap_no, error_code, oldmask;
diff --git a/arch/i386/bits/signal.h b/arch/i386/bits/signal.h
index 3caadea2..29455aec 100644
--- a/arch/i386/bits/signal.h
+++ b/arch/i386/bits/signal.h
@@ -2,13 +2,14 @@
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-struct _fpstate {
+typedef int greg_t, gregset_t[19];
+typedef struct _fpstate {
unsigned long cw, sw, tag, ipoff, cssel, dataoff, datasel;
struct {
unsigned short significand[4], exponent;
} _st[8];
unsigned long status;
-};
+} *fpregset_t;
struct sigcontext {
unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh;
unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax;
@@ -20,8 +21,8 @@ struct sigcontext {
unsigned long oldmask, cr2;
};
typedef struct {
- unsigned gregs[19];
- struct _fpstate *fpregs;
+ gregset_t gregs;
+ fpregset_t fpregs;
unsigned long oldmask, cr2;
} mcontext_t;
#else
diff --git a/arch/microblaze/bits/signal.h b/arch/microblaze/bits/signal.h
index bb60d0dd..94aafd0f 100644
--- a/arch/microblaze/bits/signal.h
+++ b/arch/microblaze/bits/signal.h
@@ -2,6 +2,7 @@
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long greg_t, gregset_t[38];
typedef struct sigcontext
{
struct {
diff --git a/arch/mips/bits/signal.h b/arch/mips/bits/signal.h
index 9b4861d3..857d3c07 100644
--- a/arch/mips/bits/signal.h
+++ b/arch/mips/bits/signal.h
@@ -2,13 +2,31 @@
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-typedef struct sigcontext
+typedef unsigned long long greg_t, gregset_t[32];
+typedef struct {
+ union {
+ double fp_dregs[32];
+ struct {
+ float _fp_fregs;
+ unsigned _fp_pad;
+ } fp_fregs[32];
+ } fp_r;
+} fpregset_t;
+struct sigcontext
{
unsigned sc_regmask, sc_status;
unsigned long long sc_pc, sc_regs[32], sc_fpregs[32];
unsigned sc_ownedfp, sc_fpc_csr, sc_fpc_eir, sc_used_math, sc_dsp;
unsigned long long sc_mdhi, sc_mdlo;
unsigned long sc_hi1, sc_lo1, sc_hi2, sc_lo2, sc_hi3, sc_lo3;
+};
+typedef struct
+{
+ unsigned regmask, status;
+ unsigned long long pc, regs[32], fpregs[32];
+ unsigned ownedfp, fpc_csr, fpc_eir, used_math, dsp;
+ unsigned long long mdhi, mdlo;
+ unsigned long hi1, lo1, hi2, lo2, hi3, lo3;
} mcontext_t;
#else
typedef struct {
diff --git a/arch/powerpc/bits/signal.h b/arch/powerpc/bits/signal.h
index 7ee38fba..81012d5b 100644
--- a/arch/powerpc/bits/signal.h
+++ b/arch/powerpc/bits/signal.h
@@ -3,7 +3,7 @@
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-typedef unsigned long gregset_t[48];
+typedef unsigned long greg_t, gregset_t[48];
typedef struct {
double fpregs[32];
diff --git a/arch/x86_64/bits/signal.h b/arch/x86_64/bits/signal.h
index 38f3bc42..9043aeaf 100644
--- a/arch/x86_64/bits/signal.h
+++ b/arch/x86_64/bits/signal.h
@@ -2,7 +2,8 @@
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-struct _fpstate {
+typedef long long greg_t, gregset_t[23];
+typedef struct _fpstate {
unsigned short cwd, swd, ftw, fop;
unsigned long long rip, rdp;
unsigned mxcsr, mxcr_mask;
@@ -13,7 +14,7 @@ struct _fpstate {
unsigned element[4];
} _xmm[16];
unsigned padding[24];
-};
+} *fpregset_t;
struct sigcontext {
unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
@@ -23,8 +24,8 @@ struct sigcontext {
unsigned long __reserved1[8];
};
typedef struct {
- unsigned long long gregs[23];
- struct _fpstate *fpregs;
+ gregset_t gregs;
+ fpregset_t fpregs;
unsigned long long __reserved1[8];
} mcontext_t;
#else
diff --git a/include/signal.h b/include/signal.h
index bef8ae04..860f7428 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -13,6 +13,7 @@ extern "C" {
#ifdef _GNU_SOURCE
#define __siginfo siginfo
+#define __ucontext ucontext
#endif
#define __NEED_size_t
diff --git a/include/ucontext.h b/include/ucontext.h
index 28d04ea8..3bb776ed 100644
--- a/include/ucontext.h
+++ b/include/ucontext.h
@@ -8,8 +8,8 @@ extern "C" {
#include <signal.h>
-#ifdef _GNU_SOURCE
-#define ucontext __ucontext
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NGREG (sizeof(gregset_t)/sizeof(greg_t))
#endif
struct __ucontext;