Merge master.kernel.org:/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
[pandora-kernel.git] / arch / mips / kernel / irixelf.c
index 7ce34d4..1bbefbf 100644 (file)
@@ -52,10 +52,6 @@ static struct linux_binfmt irix_format = {
        irix_core_dump, PAGE_SIZE
 };
 
-#ifndef elf_addr_t
-#define elf_addr_t unsigned long
-#endif
-
 #ifdef DEBUG
 /* Debugging routines. */
 static char *get_elf_p_type(Elf32_Word p_type)
@@ -999,8 +995,6 @@ static inline int maydump(struct vm_area_struct *vma)
        return 1;
 }
 
-#define roundup(x, y)  ((((x)+((y)-1))/(y))*(y))
-
 /* An ELF note in memory. */
 struct memelfnote
 {
@@ -1015,7 +1009,7 @@ static int notesize(struct memelfnote *en)
        int sz;
 
        sz = sizeof(struct elf_note);
-       sz += roundup(strlen(en->name), 4);
+       sz += roundup(strlen(en->name) + 1, 4);
        sz += roundup(en->datasz, 4);
 
        return sz;
@@ -1034,7 +1028,7 @@ static int writenote(struct memelfnote *men, struct file *file)
 {
        struct elf_note en;
 
-       en.n_namesz = strlen(men->name);
+       en.n_namesz = strlen(men->name) + 1;
        en.n_descsz = men->datasz;
        en.n_type = men->type;
 
@@ -1077,8 +1071,8 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
        struct elfhdr elf;
        off_t offset = 0, dataoff;
        int limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
-       int numnote = 4;
-       struct memelfnote notes[4];
+       int numnote = 3;
+       struct memelfnote notes[3];
        struct elf_prstatus prstatus;   /* NT_PRSTATUS */
        elf_fpregset_t fpu;             /* NT_PRFPREG */
        struct elf_prpsinfo psinfo;     /* NT_PRPSINFO */
@@ -1211,20 +1205,15 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
        }
        strlcpy(psinfo.pr_fname, current->comm, sizeof(psinfo.pr_fname));
 
-       notes[2].name = "CORE";
-       notes[2].type = NT_TASKSTRUCT;
-       notes[2].datasz = sizeof(*current);
-       notes[2].data = current;
-
        /* Try to dump the FPU. */
        prstatus.pr_fpvalid = dump_fpu (regs, &fpu);
        if (!prstatus.pr_fpvalid) {
                numnote--;
        } else {
-               notes[3].name = "CORE";
-               notes[3].type = NT_PRFPREG;
-               notes[3].datasz = sizeof(fpu);
-               notes[3].data = &fpu;
+               notes[2].name = "CORE";
+               notes[2].type = NT_PRFPREG;
+               notes[2].datasz = sizeof(fpu);
+               notes[2].data = &fpu;
        }
 
        /* Write notes phdr entry. */