fixup mcontext stuff to expost gregset_t/fpregset_t as appropriate

This commit is contained in:
Rich Felker 2012-11-25 23:04:23 -05:00
parent 4b75f4ed8d
commit a8da6c2f28
8 changed files with 35 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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];

View File

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

View File

@ -13,6 +13,7 @@ extern "C" {
#ifdef _GNU_SOURCE
#define __siginfo siginfo
#define __ucontext ucontext
#endif
#define __NEED_size_t

View File

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