x86: use generic per-device dma coherent allocator
[pandora-kernel.git] / arch / mips / kernel / irixelf.c
index 8ef5cf4..469c723 100644 (file)
 static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs);
 static int load_irix_library(struct file *);
 static int irix_core_dump(long signr, struct pt_regs * regs,
-                          struct file *file);
+                          struct file *file, unsigned long limit);
 
 static struct linux_binfmt irix_format = {
-       NULL, THIS_MODULE, load_irix_binary, load_irix_library,
-       irix_core_dump, PAGE_SIZE
+       .module         = THIS_MODULE,
+       .load_binary    = load_irix_binary,
+       .load_shlib     = load_irix_library,
+       .core_dump      = irix_core_dump,
+       .min_coredump   = PAGE_SIZE,
 };
 
 /* Debugging routines. */
@@ -575,7 +578,7 @@ static inline int map_interpreter(struct elf_phdr *epp, struct elfhdr *ihp,
  * process and the system, here we map the page and fill the
  * structure
  */
-static void irix_map_prda_page(void)
+static int irix_map_prda_page(void)
 {
        unsigned long v;
        struct prda *pp;
@@ -584,15 +587,17 @@ static void irix_map_prda_page(void)
        v =  do_brk(PRDA_ADDRESS, PAGE_SIZE);
        up_write(&current->mm->mmap_sem);
 
-       if (v < 0)
-               return;
+       if (v != PRDA_ADDRESS)
+               return v;               /* v must be an error code */
 
        pp = (struct prda *) v;
-       pp->prda_sys.t_pid  = current->pid;
+       pp->prda_sys.t_pid  = task_pid_vnr(current);
        pp->prda_sys.t_prid = read_c0_prid();
-       pp->prda_sys.t_rpid = current->pid;
+       pp->prda_sys.t_rpid = task_pid_vnr(current);
 
        /* We leave the rest set to zero */
+
+       return 0;
 }
 
 
@@ -778,7 +783,8 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
         * IRIX maps a page at 0x200000 which holds some system
         * information.  Programs depend on this.
         */
-       irix_map_prda_page();
+       if (irix_map_prda_page())
+               goto out_free_dentry;
 
        padzero(elf_bss);
 
@@ -1088,7 +1094,7 @@ end_coredump:
  * and then they are actually written out.  If we run out of core limit
  * we just truncate.
  */
-static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
+static int irix_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
 {
        int has_dumped = 0;
        mm_segment_t fs;
@@ -1098,7 +1104,6 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
        struct vm_area_struct *vma;
        struct elfhdr elf;
        off_t offset = 0, dataoff;
-       int limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
        int numnote = 3;
        struct memelfnote notes[3];
        struct elf_prstatus prstatus;   /* NT_PRSTATUS */
@@ -1168,11 +1173,11 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
        prstatus.pr_info.si_signo = prstatus.pr_cursig = signr;
        prstatus.pr_sigpend = current->pending.signal.sig[0];
        prstatus.pr_sighold = current->blocked.sig[0];
-       psinfo.pr_pid = prstatus.pr_pid = current->pid;
-       psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid;
-       psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current);
-       psinfo.pr_sid = prstatus.pr_sid = process_session(current);
-       if (current->pid == current->tgid) {
+       psinfo.pr_pid = prstatus.pr_pid = task_pid_vnr(current);
+       psinfo.pr_ppid = prstatus.pr_ppid = task_pid_vnr(current->parent);
+       psinfo.pr_pgrp = prstatus.pr_pgrp = task_pgrp_vnr(current);
+       psinfo.pr_sid = prstatus.pr_sid = task_session_vnr(current);
+       if (thread_group_leader(current)) {
                /*
                 * This is the record for the group leader.  Add in the
                 * cumulative times of previous dead threads.  This total