diff options
author | Mika Westerberg <mika.westerberg@iki.fi> | 2009-04-07 09:57:11 +0300 |
---|---|---|
committer | Riku Voipio <riku.voipio@nokia.com> | 2009-06-16 16:56:28 +0300 |
commit | edf8e2af1453ce56c72b2f25a745e3734177a05d (patch) | |
tree | 367df4d32d3d75137076cd38738199d4d5b27901 /linux-user/linuxload.c | |
parent | 88a8c98455cc28ef27f92fd0c6845cedf86d21fc (diff) |
linux-user: implemented ELF coredump support for ARM target
When target process is killed with signal (such signal that
should dump core) a coredump file is created. This file is
similar than coredump generated by Linux (there are few exceptions
though).
Riku Voipio: added support for rlimit
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'linux-user/linuxload.c')
-rw-r--r-- | linux-user/linuxload.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index ada7c697d2..14c433ea23 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -115,6 +115,7 @@ static int prepare_binprm(struct linux_binprm *bprm) abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, abi_ulong stringp, int push_ptr) { + TaskState *ts = (TaskState *)thread_env->opaque; int n = sizeof(abi_ulong); abi_ulong envp; abi_ulong argv; @@ -133,13 +134,14 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, sp -= n; /* FIXME - handle put_user() failures */ put_user_ual(argc, sp); - + ts->info->arg_start = stringp; while (argc-- > 0) { /* FIXME - handle put_user() failures */ put_user_ual(stringp, argv); argv += n; stringp += target_strlen(stringp) + 1; } + ts->info->arg_end = stringp; /* FIXME - handle put_user() failures */ put_user_ual(0, argv); while (envc-- > 0) { @@ -155,45 +157,45 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, } int loader_exec(const char * filename, char ** argv, char ** envp, - struct target_pt_regs * regs, struct image_info *infop) + struct target_pt_regs * regs, struct image_info *infop, + struct linux_binprm *bprm) { - struct linux_binprm bprm; int retval; int i; - bprm.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int); + bprm->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int); for (i=0 ; i<MAX_ARG_PAGES ; i++) /* clear page-table */ - bprm.page[i] = 0; + bprm->page[i] = 0; retval = open(filename, O_RDONLY); if (retval < 0) return retval; - bprm.fd = retval; - bprm.filename = (char *)filename; - bprm.argc = count(argv); - bprm.argv = argv; - bprm.envc = count(envp); - bprm.envp = envp; + bprm->fd = retval; + bprm->filename = (char *)filename; + bprm->argc = count(argv); + bprm->argv = argv; + bprm->envc = count(envp); + bprm->envp = envp; - retval = prepare_binprm(&bprm); + retval = prepare_binprm(bprm); infop->host_argv = argv; if(retval>=0) { - if (bprm.buf[0] == 0x7f - && bprm.buf[1] == 'E' - && bprm.buf[2] == 'L' - && bprm.buf[3] == 'F') { + if (bprm->buf[0] == 0x7f + && bprm->buf[1] == 'E' + && bprm->buf[2] == 'L' + && bprm->buf[3] == 'F') { #ifndef TARGET_HAS_ELFLOAD32 - retval = load_elf_binary(&bprm,regs,infop); + retval = load_elf_binary(bprm,regs,infop); #else - retval = load_elf_binary_multi(&bprm, regs, infop); + retval = load_elf_binary_multi(bprm, regs, infop); #endif #if defined(TARGET_HAS_BFLT) - } else if (bprm.buf[0] == 'b' - && bprm.buf[1] == 'F' - && bprm.buf[2] == 'L' - && bprm.buf[3] == 'T') { - retval = load_flt_binary(&bprm,regs,infop); + } else if (bprm->buf[0] == 'b' + && bprm->buf[1] == 'F' + && bprm->buf[2] == 'L' + && bprm->buf[3] == 'T') { + retval = load_flt_binary(bprm,regs,infop); #endif } else { fprintf(stderr, "Unknown binary format\n"); @@ -209,7 +211,7 @@ int loader_exec(const char * filename, char ** argv, char ** envp, /* Something went wrong, return the inode and free the argument pages*/ for (i=0 ; i<MAX_ARG_PAGES ; i++) { - free(bprm.page[i]); + free(bprm->page[i]); } return(retval); } |