make sys/procfs.h mostly work on most archs
authorRich Felker <dalias@aerifal.cx>
Mon, 26 Nov 2012 03:28:18 +0000 (22:28 -0500)
committerRich Felker <dalias@aerifal.cx>
Mon, 26 Nov 2012 03:28:18 +0000 (22:28 -0500)
these structures are purely for use by trace/debug tools and tools
working with core files. the definition of fpregset_t, which was
previously here, has been removed because it was wrong; fpregset_t
should be the type used in mcontext_t, not the type used in
ptrace/core stuff.

arch/arm/bits/user.h
arch/i386/bits/user.h
arch/mips/bits/user.h
arch/powerpc/bits/user.h
arch/x86_64/bits/user.h
include/sys/procfs.h

index d5f1dea..9df7a9a 100644 (file)
@@ -1,4 +1,4 @@
-struct user_fpregs {
+typedef struct user_fpregs {
        struct fp_reg {
                unsigned sign1:1;
                unsigned unused:15;
        struct fp_reg {
                unsigned sign1:1;
                unsigned unused:15;
@@ -12,11 +12,13 @@ struct user_fpregs {
        unsigned fpcr:32;
        unsigned char ftype[8];
        unsigned int init_flag;
        unsigned fpcr:32;
        unsigned char ftype[8];
        unsigned int init_flag;
-};
+} elf_fpregset_t;
 
 struct user_regs {
        unsigned long uregs[18];
 };
 
 struct user_regs {
        unsigned long uregs[18];
 };
+#define ELF_NGREG 18
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
 
 struct user {
        struct user_regs regs;
 
 struct user {
        struct user_regs regs;
index 998c062..fa62362 100644 (file)
@@ -1,17 +1,17 @@
 #undef __WORDSIZE
 #define __WORDSIZE 32
 
 #undef __WORDSIZE
 #define __WORDSIZE 32
 
-struct user_fpregs_struct
+typedef struct user_fpregs_struct
 {
        long cwd, swd, twd, fip, fcs, foo, fos, st_space[20];
 {
        long cwd, swd, twd, fip, fcs, foo, fos, st_space[20];
-};
+} elf_fpregset_t;
 
 
-struct user_fpxregs_struct
+typedef struct user_fpxregs_struct
 {
        unsigned short cwd, swd, twd, fop;
        long fip, fcs, foo, fos, mxcsr, reserved;
        long st_space[32], xmm_space[32], padding[56];
 {
        unsigned short cwd, swd, twd, fop;
        long fip, fcs, foo, fos, mxcsr, reserved;
        long st_space[32], xmm_space[32], padding[56];
-};
+} elf_fpxregset_t;
 
 struct user_regs_struct
 {
 
 struct user_regs_struct
 {
@@ -19,6 +19,9 @@ struct user_regs_struct
        long orig_eax, eip, xcs, eflags, esp, xss;
 };
 
        long orig_eax, eip, xcs, eflags, esp, xss;
 };
 
+#define ELF_NGREG 17
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
 struct user
 {
        struct user_regs_struct         regs;
 struct user
 {
        struct user_regs_struct         regs;
index 739233c..3e26249 100644 (file)
@@ -7,3 +7,7 @@ struct user {
        unsigned long magic;
        char u_comm[32];
 };
        unsigned long magic;
        char u_comm[32];
 };
+#define ELF_NGREG 45
+#define ELF_NFPREG 33
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
index 248012f..6cc8aaf 100644 (file)
@@ -12,3 +12,14 @@ struct user {
        unsigned long magic;
        char u_comm[32];
 };
        unsigned long magic;
        char u_comm[32];
 };
+
+#define ELF_NGREG 48
+#define ELF_NFPREG 33
+#define ELF_NVRREG 33
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
+typedef struct { unsigned u[4]; }
+#ifdef __GNUC__
+__attribute__((__aligned__(16)))
+#endif
+       elf_vrreg_t, elf_vrregset_t[ELF_NVRREG];
index 384f18e..8b42632 100644 (file)
@@ -1,13 +1,13 @@
 #undef __WORDSIZE
 #define __WORDSIZE 64
 
 #undef __WORDSIZE
 #define __WORDSIZE 64
 
-struct user_fpregs_struct
+typedef struct user_fpregs_struct
 {
        uint16_t cwd, swd, ftw, fop;
        uint64_t rip, rdp;
        uint32_t mxcsr, mxcs_mask;
        uint32_t st_space[32], xmm_space[64], padding[24];
 {
        uint16_t cwd, swd, ftw, fop;
        uint64_t rip, rdp;
        uint32_t mxcsr, mxcs_mask;
        uint32_t st_space[32], xmm_space[64], padding[24];
-};
+} elf_fpregset_t;
 
 struct user_regs_struct
 {
 
 struct user_regs_struct
 {
@@ -15,6 +15,8 @@ struct user_regs_struct
        unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
        unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
 };
        unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
        unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
 };
+#define ELF_NGREG 27
+typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
 
 struct user
 {
 
 struct user
 {
index 91b6efd..6a34605 100644 (file)
@@ -8,17 +8,6 @@ extern "C" {
 #include <sys/types.h>
 #include <sys/user.h>
 
 #include <sys/types.h>
 #include <sys/user.h>
 
-typedef unsigned long elf_greg_t;
-#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-#if __WORDSIZE == 32
-typedef struct user_fpregs_struct elf_fpregset_t;
-typedef struct user_fpxregs_struct elf_fpxregset_t;
-#else
-typedef struct user_fpregs_struct elf_fpregset_t;
-#endif
-
 struct elf_siginfo {
        int si_signo;
        int si_code;
 struct elf_siginfo {
        int si_signo;
        int si_code;
@@ -42,7 +31,6 @@ struct elf_prstatus {
        int pr_fpvalid;
 };
 
        int pr_fpvalid;
 };
 
-
 #define ELF_PRARGSZ 80
 
 struct elf_prpsinfo
 #define ELF_PRARGSZ 80
 
 struct elf_prpsinfo
@@ -64,19 +52,13 @@ struct elf_prpsinfo
        char pr_psargs[ELF_PRARGSZ];
 };
 
        char pr_psargs[ELF_PRARGSZ];
 };
 
-
 typedef void *psaddr_t;
 typedef elf_gregset_t prgregset_t;
 typedef void *psaddr_t;
 typedef elf_gregset_t prgregset_t;
-
 typedef elf_fpregset_t prfpregset_t;
 typedef elf_fpregset_t prfpregset_t;
-typedef elf_fpregset_t fpregset_t;
 typedef pid_t lwpid_t;
 typedef struct elf_prstatus prstatus_t;
 typedef struct elf_prpsinfo prpsinfo_t;
 
 typedef pid_t lwpid_t;
 typedef struct elf_prstatus prstatus_t;
 typedef struct elf_prpsinfo prpsinfo_t;
 
-
-
-
 #ifdef __cplusplus
 }
 #endif
 #ifdef __cplusplus
 }
 #endif