aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c12
-rw-r--r--fs/binfmt_elf.c14
-rw-r--r--include/asm-powerpc/elf.h9
-rw-r--r--include/linux/elf.h14
4 files changed, 22 insertions, 27 deletions
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index 05841cdef4e1..b0117a7c6100 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -21,6 +21,7 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23#include <linux/file.h> 23#include <linux/file.h>
24#include <linux/fs.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/syscalls.h> 26#include <linux/syscalls.h>
26#include <linux/rcupdate.h> 27#include <linux/rcupdate.h>
@@ -112,7 +113,7 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
112 return ret; 113 return ret;
113} 114}
114 115
115int arch_notes_size(void) 116int elf_coredump_extra_notes_size(void)
116{ 117{
117 struct spufs_calls *calls; 118 struct spufs_calls *calls;
118 int ret; 119 int ret;
@@ -128,17 +129,22 @@ int arch_notes_size(void)
128 return ret; 129 return ret;
129} 130}
130 131
131void arch_write_notes(struct file *file) 132int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
132{ 133{
133 struct spufs_calls *calls; 134 struct spufs_calls *calls;
134 135
135 calls = spufs_calls_get(); 136 calls = spufs_calls_get();
136 if (!calls) 137 if (!calls)
137 return; 138 return 0;
138 139
139 calls->coredump_extra_notes_write(file); 140 calls->coredump_extra_notes_write(file);
140 141
141 spufs_calls_put(calls); 142 spufs_calls_put(calls);
143
144 /* Fudge foffset for now */
145 *foffset = file->f_pos;
146
147 return 0;
142} 148}
143 149
144int register_spu_syscalls(struct spufs_calls *calls) 150int register_spu_syscalls(struct spufs_calls *calls)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 4482a0673b15..b1013f34085d 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1514,9 +1514,6 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1514 int thread_status_size = 0; 1514 int thread_status_size = 0;
1515 elf_addr_t *auxv; 1515 elf_addr_t *auxv;
1516 unsigned long mm_flags; 1516 unsigned long mm_flags;
1517#ifdef ELF_CORE_WRITE_EXTRA_NOTES
1518 int extra_notes_size;
1519#endif
1520 1517
1521 /* 1518 /*
1522 * We no longer stop all VM operations. 1519 * We no longer stop all VM operations.
@@ -1645,10 +1642,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1645 1642
1646 sz += thread_status_size; 1643 sz += thread_status_size;
1647 1644
1648#ifdef ELF_CORE_WRITE_EXTRA_NOTES 1645 sz += elf_coredump_extra_notes_size();
1649 extra_notes_size = ELF_CORE_EXTRA_NOTES_SIZE;
1650 sz += extra_notes_size;
1651#endif
1652 1646
1653 fill_elf_note_phdr(&phdr, sz, offset); 1647 fill_elf_note_phdr(&phdr, sz, offset);
1654 offset += sz; 1648 offset += sz;
@@ -1698,10 +1692,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1698 if (!writenote(notes + i, file, &foffset)) 1692 if (!writenote(notes + i, file, &foffset))
1699 goto end_coredump; 1693 goto end_coredump;
1700 1694
1701#ifdef ELF_CORE_WRITE_EXTRA_NOTES 1695 if (elf_coredump_extra_notes_write(file, &foffset))
1702 ELF_CORE_WRITE_EXTRA_NOTES; 1696 goto end_coredump;
1703 foffset += extra_notes_size;
1704#endif
1705 1697
1706 /* write out the thread status notes section */ 1698 /* write out the thread status notes section */
1707 list_for_each(t, &thread_list) { 1699 list_for_each(t, &thread_list) {
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index de507995c7b1..e42820d6d25b 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -413,13 +413,8 @@ do { \
413/* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */ 413/* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */
414#define NT_SPU 1 414#define NT_SPU 1
415 415
416extern int arch_notes_size(void);
417extern void arch_write_notes(struct file *file);
418
419#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size()
420#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file)
421
422#define ARCH_HAVE_EXTRA_ELF_NOTES 416#define ARCH_HAVE_EXTRA_ELF_NOTES
423#endif /* CONFIG_PPC_CELL */ 417
418#endif /* CONFIG_SPU_BASE */
424 419
425#endif /* _ASM_POWERPC_ELF_H */ 420#endif /* _ASM_POWERPC_ELF_H */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 8b17ffe222c4..d2da84acf45d 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -389,12 +389,14 @@ extern Elf64_Dyn _DYNAMIC [];
389 389
390#endif 390#endif
391 391
392/* Optional callbacks to write extra ELF notes. */
392#ifndef ARCH_HAVE_EXTRA_ELF_NOTES 393#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
393static inline int arch_notes_size(void) { return 0; } 394static inline int elf_coredump_extra_notes_size(void) { return 0; }
394static inline void arch_write_notes(struct file *file) { } 395static inline int elf_coredump_extra_notes_write(struct file *file,
395 396 loff_t *foffset) { return 0; }
396#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size() 397#else
397#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file) 398extern int elf_coredump_extra_notes_size(void);
398#endif /* ARCH_HAVE_EXTRA_ELF_NOTES */ 399extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset);
400#endif
399 401
400#endif /* _LINUX_ELF_H */ 402#endif /* _LINUX_ELF_H */