[CVE-2009-0029] sparc: Enable syscall wrappers for 64-bit
[linux-2.6/next.git] / arch / ia64 / ia32 / elfcore32.h
blob9a3abf58cea34580edc399f25d6d2750198214f7
1 /*
2 * IA-32 ELF core dump support.
4 * Copyright (C) 2003 Arun Sharma <arun.sharma@intel.com>
6 * Derived from the x86_64 version
7 */
8 #ifndef _ELFCORE32_H_
9 #define _ELFCORE32_H_
11 #include <asm/intrinsics.h>
12 #include <asm/uaccess.h>
14 #define USE_ELF_CORE_DUMP 1
16 /* Override elfcore.h */
17 #define _LINUX_ELFCORE_H 1
18 typedef unsigned int elf_greg_t;
20 #define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t))
21 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
23 typedef struct ia32_user_i387_struct elf_fpregset_t;
24 typedef struct ia32_user_fxsr_struct elf_fpxregset_t;
26 struct elf_siginfo
28 int si_signo; /* signal number */
29 int si_code; /* extra code */
30 int si_errno; /* errno */
33 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
35 * Hacks are here since types between compat_timeval (= pair of s32) and
36 * ia64-native timeval (= pair of s64) are not compatible, at least a file
37 * arch/ia64/ia32/../../../fs/binfmt_elf.c will get warnings from compiler on
38 * use of cputime_to_timeval(), which usually an alias of jiffies_to_timeval().
40 #define cputime_to_timeval(a,b) \
41 do { (b)->tv_usec = 0; (b)->tv_sec = (a)/NSEC_PER_SEC; } while(0)
42 #else
43 #define jiffies_to_timeval(a,b) \
44 do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; } while(0)
45 #endif
47 struct elf_prstatus
49 struct elf_siginfo pr_info; /* Info associated with signal */
50 short pr_cursig; /* Current signal */
51 unsigned int pr_sigpend; /* Set of pending signals */
52 unsigned int pr_sighold; /* Set of held signals */
53 pid_t pr_pid;
54 pid_t pr_ppid;
55 pid_t pr_pgrp;
56 pid_t pr_sid;
57 struct compat_timeval pr_utime; /* User time */
58 struct compat_timeval pr_stime; /* System time */
59 struct compat_timeval pr_cutime; /* Cumulative user time */
60 struct compat_timeval pr_cstime; /* Cumulative system time */
61 elf_gregset_t pr_reg; /* GP registers */
62 int pr_fpvalid; /* True if math co-processor being used. */
65 #define ELF_PRARGSZ (80) /* Number of chars for args */
67 struct elf_prpsinfo
69 char pr_state; /* numeric process state */
70 char pr_sname; /* char for pr_state */
71 char pr_zomb; /* zombie */
72 char pr_nice; /* nice val */
73 unsigned int pr_flag; /* flags */
74 __u16 pr_uid;
75 __u16 pr_gid;
76 pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
77 /* Lots missing */
78 char pr_fname[16]; /* filename of executable */
79 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
82 #define ELF_CORE_COPY_REGS(pr_reg, regs) \
83 pr_reg[0] = regs->r11; \
84 pr_reg[1] = regs->r9; \
85 pr_reg[2] = regs->r10; \
86 pr_reg[3] = regs->r14; \
87 pr_reg[4] = regs->r15; \
88 pr_reg[5] = regs->r13; \
89 pr_reg[6] = regs->r8; \
90 pr_reg[7] = regs->r16 & 0xffff; \
91 pr_reg[8] = (regs->r16 >> 16) & 0xffff; \
92 pr_reg[9] = (regs->r16 >> 32) & 0xffff; \
93 pr_reg[10] = (regs->r16 >> 48) & 0xffff; \
94 pr_reg[11] = regs->r1; \
95 pr_reg[12] = regs->cr_iip; \
96 pr_reg[13] = regs->r17 & 0xffff; \
97 pr_reg[14] = ia64_getreg(_IA64_REG_AR_EFLAG); \
98 pr_reg[15] = regs->r12; \
99 pr_reg[16] = (regs->r17 >> 16) & 0xffff;
101 static inline void elf_core_copy_regs(elf_gregset_t *elfregs,
102 struct pt_regs *regs)
104 ELF_CORE_COPY_REGS((*elfregs), regs)
107 static inline int elf_core_copy_task_regs(struct task_struct *t,
108 elf_gregset_t* elfregs)
110 ELF_CORE_COPY_REGS((*elfregs), task_pt_regs(t));
111 return 1;
114 static inline int
115 elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpregset_t *fpu)
117 struct ia32_user_i387_struct *fpstate = (void*)fpu;
118 mm_segment_t old_fs;
120 if (!tsk_used_math(tsk))
121 return 0;
123 old_fs = get_fs();
124 set_fs(KERNEL_DS);
125 save_ia32_fpstate(tsk, (struct ia32_user_i387_struct __user *) fpstate);
126 set_fs(old_fs);
128 return 1;
131 #define ELF_CORE_COPY_XFPREGS 1
132 #define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
133 static inline int
134 elf_core_copy_task_xfpregs(struct task_struct *tsk, elf_fpxregset_t *xfpu)
136 struct ia32_user_fxsr_struct *fpxstate = (void*) xfpu;
137 mm_segment_t old_fs;
139 if (!tsk_used_math(tsk))
140 return 0;
142 old_fs = get_fs();
143 set_fs(KERNEL_DS);
144 save_ia32_fpxstate(tsk, (struct ia32_user_fxsr_struct __user *) fpxstate);
145 set_fs(old_fs);
147 return 1;
150 #endif /* _ELFCORE32_H_ */