linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / x86_64 / ia32 / ia32_binfmt.c
index c4a86f3..4cccf13 100644 (file)
@@ -46,7 +46,7 @@ struct elf_phdr;
 
 #define IA32_EMULATOR 1
 
-#define ELF_ET_DYN_BASE                (TASK_UNMAPPED_32 + 0x1000000)
+#define ELF_ET_DYN_BASE                (TASK_UNMAPPED_BASE + 0x1000000)
 
 #undef ELF_ARCH
 #define ELF_ARCH EM_386
@@ -197,8 +197,7 @@ static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *re
 
 static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
 {      
-       struct pt_regs *pp = (struct pt_regs *)(t->thread.rsp0);
-       --pp;
+       struct pt_regs *pp = task_pt_regs(t);
        ELF_CORE_COPY_REGS((*elfregs), pp);
        /* fix wrong segments */ 
        (*elfregs)[7] = t->thread.ds; 
@@ -217,8 +216,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
        if (!tsk_used_math(tsk))
                return 0;
        if (!regs)
-               regs = (struct pt_regs *)tsk->thread.rsp0;
-       --regs;
+               regs = task_pt_regs(tsk);
        if (tsk == current)
                unlazy_fpu(tsk);
        set_fs(KERNEL_DS); 
@@ -234,7 +232,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
 static inline int 
 elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
 {
-       struct pt_regs *regs = ((struct pt_regs *)(t->thread.rsp0))-1; 
+       struct pt_regs *regs = task_pt_regs(t);
        if (!tsk_used_math(t))
                return 0;
        if (t == current)
@@ -295,8 +293,6 @@ int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, int
 } while(0) 
 
 
-#define elf_map elf32_map
-
 #include <linux/module.h>
 
 MODULE_DESCRIPTION("Binary format loader for compatibility with IA32 ELF binaries."); 
@@ -307,9 +303,6 @@ MODULE_AUTHOR("Eric Youngdale, Andi Kleen");
 
 #define elf_addr_t __u32
 
-#undef TASK_SIZE
-#define TASK_SIZE 0xffffffff
-
 static void elf32_init(struct pt_regs *);
 
 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
@@ -338,9 +331,10 @@ static void elf32_init(struct pt_regs *regs)
        me->thread.es = __USER_DS;
 }
 
-int setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, int executable_stack)
+int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top,
+                        int executable_stack)
 {
-       unsigned long stack_base, grow;
+       unsigned long stack_base;
        struct vm_area_struct *mpnt;
        struct mm_struct *mm = current->mm;
        int i, ret;
@@ -356,14 +350,6 @@ int setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, int exec
        mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
        if (!mpnt) 
                return -ENOMEM; 
-       
-       grow = (IA32_STACK_TOP - (PAGE_MASK & (unsigned long) bprm->p))
-               >> PAGE_SHIFT;
-       if (security_vm_enough_memory(grow) ||
-               !vx_vmpages_avail(mm, grow)) {
-               kmem_cache_free(vm_area_cachep, mpnt);
-               return -ENOMEM;
-       }
 
        memset(mpnt, 0, sizeof(*mpnt));
 
@@ -401,21 +387,7 @@ int setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, int exec
        
        return 0;
 }
-
-static unsigned long
-elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
-{
-       unsigned long map_addr;
-       struct task_struct *me = current; 
-
-       down_write(&me->mm->mmap_sem);
-       map_addr = do_mmap(filep, ELF_PAGESTART(addr),
-                          eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr), prot, 
-                          type,
-                          eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr));
-       up_write(&me->mm->mmap_sem);
-       return(map_addr);
-}
+EXPORT_SYMBOL(ia32_setup_arg_pages);
 
 #ifdef CONFIG_SYSCTL
 /* Register vsyscall32 into the ABI table */