Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

irixelf.c File Reference

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/a.out.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/signal.h>
#include <linux/binfmts.h>
#include <linux/string.h>
#include <linux/fcntl.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/shm.h>
#include <linux/personality.h>
#include <linux/elfcore.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/mipsregs.h>
#include <asm/prctl.h>
#include <linux/config.h>
#include <linux/elf.h>

Include dependency graph for irixelf.c:

Go to the source code of this file.

Defines

#define DLINFO_ITEMS   12
#define elf_addr_t   unsigned long
#define elf_caddr_t   char *
#define NEW_AUX_ENT(nr, id, val)
#define IRIX_INTERP_PREFIX   "/usr/gnemul/irix"
#define EXEC_MAP_FLAGS   (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE)
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
#define DUMP_WRITE(addr, nr)   do { if (!dump_write(file, (addr), (nr))) return 0; } while(0)
#define DUMP_SEEK(off)   do { if (!dump_seek(file, (off))) return 0; } while(0)
#define DUMP_WRITE(addr, nr)
#define DUMP_SEEK(off)

Functions

static int load_irix_binary (struct linux_binprm *bprm, struct pt_regs *regs)
static int load_irix_library (struct file *file)
static int irix_core_dump (long signr, struct pt_regs *regs, struct file *)
int dump_fpu (elf_fpregset_t *)
static void set_brk (unsigned long start, unsigned long end)
static void padzero (unsigned long elf_bss)
unsigned longcreate_irix_tables (char *p, int argc, int envc, struct elfhdr *exec, unsigned int load_addr, unsigned int interp_load_addr, struct pt_regs *regs, struct elf_phdr *ephdr)
static unsigned int load_irix_interp (struct elfhdr *interp_elf_ex, struct dentry *interpreter_dentry, unsigned int *interp_load_addr)
static int verify_binary (struct elfhdr *ehp, struct linux_binprm *bprm)
static int look_for_irix_interpreter (char **name, struct dentry **interpreter_dentry, struct elfhdr *interp_elf_ex, struct elf_phdr *epp, struct linux_binprm *bprm, int pnum)
static int verify_irix_interpreter (struct elfhdr *ihp)
static void map_executable (struct file *fp, struct elf_phdr *epp, int pnum, unsigned int *estack, unsigned int *laddr, unsigned int *scode, unsigned int *ebss, unsigned int *ecode, unsigned int *edata, unsigned int *ebrk)
static int map_interpreter (struct elf_phdr *epp, struct elfhdr *ihp, struct dentry *identry, unsigned int *iladdr, int pnum, mm_segment_t old_fs, unsigned int *eentry)
void irix_map_prda_page (void)
unsigned long irix_mapelf (int fd, struct elf_phdr *user_phdrp, int cnt)
static int dump_write (struct file *file, const void *addr, int nr)
static int dump_seek (struct file *file, off_t off)
static int maydump (struct vm_area_struct *vma)
static int notesize (struct memelfnote *en)
static int writenote (struct memelfnote *men, struct file *file)
int __init init_irix_binfmt (void)

Variables

static struct linux_binfmt irix_format


Define Documentation

#define DLINFO_ITEMS   12
 

Definition at line 39 of file irixelf.c.

Referenced by create_elf_tables(), and create_irix_tables().

#define DUMP_SEEK off   ) 
 

Value:

if (!dump_seek(file, (off))) \
                goto close_coredump;

Definition at line 1092 of file irixelf.c.

#define DUMP_SEEK off   )     do { if (!dump_seek(file, (off))) return 0; } while(0)
 

Definition at line 1092 of file irixelf.c.

Referenced by aout_core_dump(), irix_core_dump(), and writenote().

#define DUMP_WRITE addr,
nr   ) 
 

Value:

if (!dump_write(file, (addr), (nr))) \
                goto close_coredump;

Definition at line 1089 of file irixelf.c.

#define DUMP_WRITE addr,
nr   )     do { if (!dump_write(file, (addr), (nr))) return 0; } while(0)
 

Definition at line 1089 of file irixelf.c.

Referenced by aout32_core_dump(), aout_core_dump(), irix_core_dump(), and writenote().

#define elf_addr_t   unsigned long
 

Definition at line 59 of file irixelf.c.

Referenced by add_symbol(), adjust_object_offsets(), create_elf_tables(), create_irix_tables(), map_address(), Oops_decode_one(), Oops_read(), Oops_set_oi7(), and Oops_set_ra().

#define elf_caddr_t   char *
 

Definition at line 60 of file irixelf.c.

Referenced by create_elf_tables(), and create_irix_tables().

#define EXEC_MAP_FLAGS   (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE)
 

Definition at line 508 of file irixelf.c.

Referenced by map_executable().

#define IRIX_INTERP_PREFIX   "/usr/gnemul/irix"
 

Definition at line 443 of file irixelf.c.

Referenced by look_for_irix_interpreter().

#define NEW_AUX_ENT nr,
id,
val   ) 
 

Value:

__put_user ((id), sp+(nr*2)); \
          __put_user ((val), sp+(nr*2+1)); \

Referenced by create_elf_tables(), and create_irix_tables().

#define roundup x,
y   )     ((((x)+((y)-1))/(y))*(y))
 

Definition at line 1040 of file irixelf.c.

Referenced by irix_core_dump(), notesize(), and writenote().


Function Documentation

unsigned long* create_irix_tables char *  p,
int  argc,
int  envc,
struct elfhdr *  exec,
unsigned int  load_addr,
unsigned int  interp_load_addr,
struct pt_regs regs,
struct elf_phdr *  ephdr
 

Definition at line 158 of file irixelf.c.

References __put_user, AT_BASE, AT_EGID, AT_ENTRY, AT_EUID, AT_FLAGS, AT_GID, AT_NULL, AT_PAGESZ, AT_PHDR, AT_PHENT, AT_PHNUM, AT_UID, current, DLINFO_ITEMS, elf_addr_t, elf_caddr_t, ELF_EXEC_PAGESIZE, elf_phdr, envp, long, NEW_AUX_ENT, NULL, printk, sp, and strlen_user.

Referenced by load_irix_binary().

int dump_fpu elf_fpregset_t  ) 
 

static int dump_seek struct file file,
off_t  off
[static]
 

Definition at line 1011 of file irixelf.c.

static int dump_write struct file file,
const void *  addr,
int  nr
[static]
 

Definition at line 1000 of file irixelf.c.

References down(), r, and up.

Here is the call graph for this function:

int __init init_irix_binfmt void   ) 
 

Definition at line 1330 of file irixelf.c.

References irix_format, and register_binfmt().

Here is the call graph for this function:

static int irix_core_dump long  signr,
struct pt_regs regs,
struct file
[static]
 

Definition at line 1101 of file irixelf.c.

References addr, copy_from_user, CT_TO_SECS, CT_TO_USECS, current, memelfnote::data, memelfnote::datasz, dump_fpu(), DUMP_SEEK, DUMP_WRITE, EI_CLASS, EI_DATA, EI_NIDENT, EI_PAD, EI_VERSION, ELF_ARCH, elf_phdr, ELF_PRARGSZ, ELFCLASS32, ELFDATA2LSB, elfhdr, ELFMAG, ET_CORE, EV_CURRENT, ffz(), fs, get_fs, KERNEL_DS, len, limit(), maydump(), memcpy, memset, memelfnote::name, notesize(), NT_PRFPREG, NT_PRPSINFO, NT_PRSTATUS, NT_TASKSTRUCT, NULL, offset, PAGE_SIZE, PF_R, PF_W, PF_X, printk, PT_LOAD, PT_NOTE, RLIMIT_CORE, roundup, SELFMAG, set_fs, size, strncpy, memelfnote::type, and writenote().

Here is the call graph for this function:

void irix_map_prda_page void   ) 
 

Definition at line 589 of file irixelf.c.

References CP0_PRID, current, do_mmap(), MAP_FIXED, MAP_PRIVATE, NULL, PAGE_SIZE, pp, PRDA_ADDRESS, prda::prda_sys, PROT_EXEC, PROT_READ, PROT_WRITE, read_32bit_cp0_register, prda_sys::t_pid, prda_sys::t_prid, prda_sys::t_rpid, and v.

Referenced by load_irix_binary().

Here is the call graph for this function:

unsigned long irix_mapelf int  fd,
struct elf_phdr *  user_phdrp,
int  cnt
 

Definition at line 924 of file irixelf.c.

References do_mmap(), EACCES, elf_phdr, ENOEXEC, fget(), file, filp, fput(), MAP_DENYWRITE, MAP_FIXED, MAP_PRIVATE, PF_R, PF_W, PF_X, printk, PROT_EXEC, PROT_READ, PROT_WRITE, PT_LOAD, verify_area(), VERIFY_READ, and xfff.

Referenced by irix_syssgi().

Here is the call graph for this function:

static int load_irix_binary struct linux_binprm *  bprm,
struct pt_regs regs
[static]
 

Definition at line 613 of file irixelf.c.

References __MOD_DEC_USE_COUNT, __MOD_INC_USE_COUNT, compute_creds(), create_irix_tables(), current, do_mmap(), E2BIG, elf_phdr, elfhdr, ENOEXEC, ENOMEM, fget(), file, flush_old_exec(), fput(), get_ds, get_fs, irix_format, irix_map_prda_page(), kfree(), kmalloc(), long, look_for_irix_interpreter(), lookup_exec_domain(), map_executable(), MAP_FIXED, map_interpreter(), MAP_PRIVATE, NULL, O_RDONLY, open_dentry(), padzero(), PER_IRIX32, printk, PROT_EXEC, PROT_READ, PT_INTERP, PT_PHDR, PT_PTRACED, read_exec(), send_sig(), set_binfmt(), set_brk(), set_fs, setup_arg_pages(), SIGSEGV, SIGTRAP, size, start_code, start_thread, sys_close, verify_binary(), and verify_irix_interpreter().

Here is the call graph for this function:

static unsigned int load_irix_interp struct elfhdr *  interp_elf_ex,
struct dentry *  interpreter_dentry,
unsigned int *  interp_load_addr
[static]
 

Definition at line 237 of file irixelf.c.

References do_mmap(), elf_check_arch, elf_phdr, error, ET_DYN, ET_EXEC, fget(), file, fput(), k, kfree(), kmalloc(), len, MAP_DENYWRITE, MAP_FIXED, MAP_PRIVATE, NULL, O_RDONLY, open_dentry(), padzero(), PAGE_SIZE, PF_R, PF_W, PF_X, printk, PROT_EXEC, PROT_READ, PROT_WRITE, PT_LOAD, read_exec(), sys_close, and xfff.

Referenced by map_interpreter().

Here is the call graph for this function:

static int load_irix_library struct file file  )  [static]
 

Definition at line 823 of file irixelf.c.

References do_mmap(), EACCES, elf_check_arch, elf_phdr, elfhdr, ENOEXEC, ENOMEM, error, ET_EXEC, j, k, KERNEL_DS, kfree(), kmalloc(), len, MAP_DENYWRITE, MAP_FIXED, MAP_PRIVATE, NULL, padzero(), PAGE_SIZE, PROT_EXEC, PROT_READ, PROT_WRITE, PT_LOAD, read_exec(), set_fs, strncmp(), USER_DS, x7f, and xfff.

Here is the call graph for this function:

static int look_for_irix_interpreter char **  name,
struct dentry **  interpreter_dentry,
struct elfhdr *  interp_elf_ex,
struct elf_phdr *  epp,
struct linux_binprm *  bprm,
int  pnum
[inline, static]
 

Definition at line 446 of file irixelf.c.

References dput(), EINVAL, elfhdr, ENOMEM, get_ds, get_fs, IRIX_INTERP_PREFIX, kfree(), kmalloc(), NULL, out, PT_INTERP, read_exec(), set_fs, strcpy, and strlen.

Referenced by load_irix_binary().

Here is the call graph for this function:

static void map_executable struct file fp,
struct elf_phdr *  epp,
int  pnum,
unsigned int *  estack,
unsigned int *  laddr,
unsigned int *  scode,
unsigned int *  ebss,
unsigned int *  ecode,
unsigned int *  edata,
unsigned int *  ebrk
[inline, static]
 

Definition at line 510 of file irixelf.c.

References do_mmap(), EXEC_MAP_FLAGS, PF_R, PF_W, PF_X, PROT_EXEC, PROT_READ, PROT_WRITE, PT_LOAD, tmp, and xfff.

Referenced by load_irix_binary().

Here is the call graph for this function:

static int map_interpreter struct elf_phdr *  epp,
struct elfhdr *  ihp,
struct dentry *  identry,
unsigned int *  iladdr,
int  pnum,
mm_segment_t  old_fs,
unsigned int *  eentry
[inline, static]
 

Definition at line 555 of file irixelf.c.

References dput(), get_ds, get_fs, load_irix_interp(), PT_INTERP, and set_fs.

Referenced by load_irix_binary().

Here is the call graph for this function:

static int maydump struct vm_area_struct *  vma  )  [inline, static]
 

Definition at line 1027 of file irixelf.c.

Referenced by irix_core_dump().

static int notesize struct memelfnote en  )  [static]
 

Definition at line 1051 of file irixelf.c.

References elf_note, roundup, and strlen.

Referenced by irix_core_dump().

static void padzero unsigned long  elf_bss  )  [static]
 

Definition at line 147 of file irixelf.c.

References clear_user, and PAGE_SIZE.

Referenced by load_elf_binary(), load_elf_interp(), load_elf_library(), load_irix_binary(), load_irix_interp(), and load_irix_library().

static void set_brk unsigned long  start,
unsigned long  end
[static]
 

Definition at line 130 of file irixelf.c.

References do_mmap(), MAP_FIXED, MAP_PRIVATE, NULL, PAGE_ALIGN, PROT_EXEC, PROT_READ, and PROT_WRITE.

Referenced by load_aout32_binary(), load_aout_binary(), load_elf_binary(), load_irix_binary(), and sys_brk().

Here is the call graph for this function:

static int verify_binary struct elfhdr *  ehp,
struct linux_binprm *  bprm
[static]
 

Definition at line 410 of file irixelf.c.

References EF_MIPS_ARCH, elf_check_arch, ENOEXEC, ET_DYN, ET_EXEC, strncmp(), and x7f.

Referenced by load_irix_binary().

Here is the call graph for this function:

static int verify_irix_interpreter struct elfhdr *  ihp  )  [inline, static]
 

Definition at line 501 of file irixelf.c.

References ELIBBAD, and strncmp().

Referenced by load_irix_binary().

Here is the call graph for this function:

static int writenote struct memelfnote men,
struct file file
[static]
 

Definition at line 1069 of file irixelf.c.

References memelfnote::data, memelfnote::datasz, DUMP_SEEK, DUMP_WRITE, elf_note, memelfnote::name, roundup, strlen, and memelfnote::type.

Referenced by irix_core_dump().


Variable Documentation

struct linux_binfmt irix_format [static]
 

Initial value:

 {
        module:         THIS_MODULE,
        load_binary:    load_irix_binary,
        load_shlib:     load_irix_library,
        core_dump:      irix_core_dump,
        min_coredump:   PAGE_SIZE,
}

Definition at line 50 of file irixelf.c.

Referenced by init_irix_binfmt(), and load_irix_binary().