2 * IA-32 ELF core dump support.
4 * Copyright (C) 2003 Arun Sharma <arun.sharma@intel.com>
6 * Derived from the x86_64 version
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
;
28 int si_signo
; /* signal number */
29 int si_code
; /* extra code */
30 int si_errno
; /* errno */
33 #define jiffies_to_timeval(a,b) do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; }while(0)
37 struct elf_siginfo pr_info
; /* Info associated with signal */
38 short pr_cursig
; /* Current signal */
39 unsigned int pr_sigpend
; /* Set of pending signals */
40 unsigned int pr_sighold
; /* Set of held signals */
45 struct compat_timeval pr_utime
; /* User time */
46 struct compat_timeval pr_stime
; /* System time */
47 struct compat_timeval pr_cutime
; /* Cumulative user time */
48 struct compat_timeval pr_cstime
; /* Cumulative system time */
49 elf_gregset_t pr_reg
; /* GP registers */
50 int pr_fpvalid
; /* True if math co-processor being used. */
53 #define ELF_PRARGSZ (80) /* Number of chars for args */
57 char pr_state
; /* numeric process state */
58 char pr_sname
; /* char for pr_state */
59 char pr_zomb
; /* zombie */
60 char pr_nice
; /* nice val */
61 unsigned int pr_flag
; /* flags */
64 pid_t pr_pid
, pr_ppid
, pr_pgrp
, pr_sid
;
66 char pr_fname
[16]; /* filename of executable */
67 char pr_psargs
[ELF_PRARGSZ
]; /* initial part of arg list */
70 #define ELF_CORE_COPY_REGS(pr_reg, regs) \
71 pr_reg[0] = regs->r11; \
72 pr_reg[1] = regs->r9; \
73 pr_reg[2] = regs->r10; \
74 pr_reg[3] = regs->r14; \
75 pr_reg[4] = regs->r15; \
76 pr_reg[5] = regs->r13; \
77 pr_reg[6] = regs->r8; \
78 pr_reg[7] = regs->r16 & 0xffff; \
79 pr_reg[8] = (regs->r16 >> 16) & 0xffff; \
80 pr_reg[9] = (regs->r16 >> 32) & 0xffff; \
81 pr_reg[10] = (regs->r16 >> 48) & 0xffff; \
82 pr_reg[11] = regs->r1; \
83 pr_reg[12] = regs->cr_iip; \
84 pr_reg[13] = regs->r17 & 0xffff; \
85 pr_reg[14] = ia64_getreg(_IA64_REG_AR_EFLAG); \
86 pr_reg[15] = regs->r12; \
87 pr_reg[16] = (regs->r17 >> 16) & 0xffff;
89 static inline void elf_core_copy_regs(elf_gregset_t
*elfregs
,
92 ELF_CORE_COPY_REGS((*elfregs
), regs
)
95 static inline int elf_core_copy_task_regs(struct task_struct
*t
,
96 elf_gregset_t
* elfregs
)
98 ELF_CORE_COPY_REGS((*elfregs
), task_pt_regs(t
));
103 elf_core_copy_task_fpregs(struct task_struct
*tsk
, struct pt_regs
*regs
, elf_fpregset_t
*fpu
)
105 struct ia32_user_i387_struct
*fpstate
= (void*)fpu
;
108 if (!tsk_used_math(tsk
))
113 save_ia32_fpstate(tsk
, (struct ia32_user_i387_struct __user
*) fpstate
);
119 #define ELF_CORE_COPY_XFPREGS 1
120 #define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
122 elf_core_copy_task_xfpregs(struct task_struct
*tsk
, elf_fpxregset_t
*xfpu
)
124 struct ia32_user_fxsr_struct
*fpxstate
= (void*) xfpu
;
127 if (!tsk_used_math(tsk
))
132 save_ia32_fpxstate(tsk
, (struct ia32_user_fxsr_struct __user
*) fpxstate
);
138 #endif /* _ELFCORE32_H_ */