Skip to contentSkip to conversation

ia32 core dumps

PATCH Arun Sharma 3 participants 3 messages Aug 7, 2003 – Aug 8, 2003 exec and binfmt

lore
Share & tools
lore
#0 lore raw

The attached patch implements core dump functionality for IA-32 applications running on ia64. In the absence of this patch, the kernel BUG()s out on ia32 core dump on 2.6.

-Arun

===== arch/ia64/ia32/binfmt_elf32.c 1.14 vs edited =====

arch/ia64/ia32/binfmt_elf32.c +1 -0
@@ -19,6 +19,7 @@
 #include <asm/signal.h>
 
 #include "ia32priv.h"
+#include "elfcore32.h"
 
 #define CONFIG_BINFMT_ELF32
 

===== arch/ia64/ia32/ia32priv.h 1.1 vs edited =====

arch/ia64/ia32/ia32priv.h +17 -15
@@ -295,7 +295,6 @@
 #define IA32_TSS_OFFSET		(IA32_PAGE_OFFSET + PAGE_SIZE)
 #define IA32_LDT_OFFSET		(IA32_PAGE_OFFSET + 2*PAGE_SIZE)
 
-#define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE	IA32_PAGE_SIZE
 
 /*
@@ -312,20 +311,6 @@
 
 #define elf_addr_t	u32
 
-/* ELF register definitions.  This is needed for core dump support.  */
-
-#define ELF_NGREG	128			/* XXX fix me */
-#define ELF_NFPREG	128			/* XXX fix me */
-
-typedef unsigned long elf_greg_t;
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef struct {
-	unsigned long w0;
-	unsigned long w1;
-} elf_fpreg_t;
-typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
-
 /* This macro yields a bitmask that programs can use to figure out
    what instruction set this CPU supports.  */
 #define ELF_HWCAP	0
@@ -471,6 +456,23 @@
 	register double f6 asm ("f6"); \
 	asm volatile ("ldf.fill f6=[%2];; stfe [%1]=f6" : "=f"(f6): "r"(dst),  "r"(src) : "memory"); \
 	} while(0)
+
+struct user_regs_struct32 {
+	__u32 ebx, ecx, edx, esi, edi, ebp, eax;
+	unsigned short ds, __ds, es, __es;
+	unsigned short fs, __fs, gs, __gs;
+	__u32 orig_eax, eip;
+	unsigned short cs, __cs;
+	__u32 eflags, esp;
+	unsigned short ss, __ss;
+};
+
+/* Prototypes for use in elfcore32.h */
+int save_ia32_fpstate (struct task_struct *tsk, 
+                       struct ia32_user_i387_struct *save);
+
+int save_ia32_fpxstate (struct task_struct *tsk, 
+			struct ia32_user_fxsr_struct *save);
 
 #endif /* !CONFIG_IA32_SUPPORT */
 

===== arch/ia64/ia32/sys_ia32.c 1.68 vs edited =====

arch/ia64/ia32/sys_ia32.c +2 -2
@@ -1866,7 +1866,7 @@
 	return;
 }
 
-static int
+int
 save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *save)
 {
 	struct switch_stack *swp;
@@ -1928,7 +1928,7 @@
 	return 0;
 }
 
-static int
+int
 save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct *save)
 {
 	struct switch_stack *swp;
arch/ia64/ia32/elfcore32.h new file +128 -0

128 lines not on this page · raw message

#1 lore raw
Quoted 2 lines · Arun Sharma

The attached patch implements core dump functionality for IA-32 applications running on ia64.

I just needed one little change to make it work against current linus bitkeeper. Otherwise it works great, thanks!

-i
[email protected]
http://www.gelato.unsw.edu.au

===== elfcore32.h 1.1 vs 1.2 =====

arch/ia64/ia32/elfcore32.h +1 -1
@@ -99,7 +99,7 @@
 }
 
 static inline int 
-elf_core_copy_task_fpregs(struct task_struct *tsk, elf_fpregset_t *fpu)
+elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *xregs, elf_fpregset_t *fpu)
 {
 	struct ia32_user_i387_struct *fpstate = (void*)fpu;
 
#2 lore raw
In reply to Arun Sharma

Yes, I noticed that one too.

	--david
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Ian Wienand
Quoted 2 lines · Arun Sharma
Quoted 2 lines

The attached patch implements core dump functionality for IA-32 applications running on ia64.

Ian> I just needed one little change to make it work against current Ian> linus bitkeeper. Otherwise it works great, thanks!

Ian> -i [email protected] http://www.gelato.unsw.edu.au== Ian> elfcore32.h 1.1 vs 1.2 === --- 1.1/arch/ia64/ia32/elfcore32.h Ian> Fri Aug 8 09:07:30 2003 +++ 1.2/arch/ia64/ia32/elfcore32.h Fri
Ian> Aug 8 10:05:00 2003 @@ -99,7 +99,7 @@ }

  Ian>  static inline int -elf_core_copy_task_fpregs(struct
  Ian> task_struct *tsk, elf_fpregset_t *fpu)
  Ian> +elf_core_copy_task_fpregs(struct task_struct *tsk, struct
  Ian> pt_regs *xregs, elf_fpregset_t *fpu) { struct
  Ian> ia32_user_i387_struct *fpstate = (void*)fpu;