int loader_exec(const char * filename, char ** argv, char ** envp,

             struct target_pt_regs * regs, struct image_info *infop)

{

    struct linux_binprm bprm;

    int retval;

    int i;



    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] = NULL;

    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;



    retval = prepare_binprm(&bprm);



    if(retval>=0) {

        if (bprm.buf[0] == 0x7f

                && bprm.buf[1] == 'E'

                && bprm.buf[2] == 'L'

                && bprm.buf[3] == 'F') {

            retval = load_elf_binary(&bprm,regs,infop);

        } else {

            fprintf(stderr, "Unknown binary format\n");

            return -1;

        }

    }



    if(retval>=0) {

        /* success.  Initialize important registers */

        do_init_thread(regs, infop);

        return retval;

    }



    /* Something went wrong, return the inode and free the argument pages*/

    for (i=0 ; i<MAX_ARG_PAGES ; i++) {

        free(bprm.page[i]);

    }

    return(retval);

}

int loader_exec(const char * filename, char ** argv, char ** envp,

             struct target_pt_regs * regs, struct image_info *infop)

{

    struct linux_binprm bprm;

    int retval;

    int i;



    bprm.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);

    for (i=0 ; i<MAX_ARG_PAGES ; i++)       

            bprm.page[i] = NULL;

    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;



    retval = prepare_binprm(&bprm);



    if(retval>=0) {

        if (bprm.buf[0] == 0x7f

                && bprm.buf[1] == 'E'

                && bprm.buf[2] == 'L'

                && bprm.buf[3] == 'F') {

            retval = load_elf_binary(&bprm,regs,infop);

        } else {

            fprintf(stderr, "Unknown binary format\n");

            return -1;

        }

    }



    if(retval>=0) {

        

        do_init_thread(regs, infop);

        return retval;

    }



    

    for (i=0 ; i<MAX_ARG_PAGES ; i++) {

        free(bprm.page[i]);

    }

    return(retval);

}

        free(bprm.page[i]);
int FUNC_0(const char * VAR_0, char ** VAR_1, char ** VAR_2,

             struct target_pt_regs * VAR_3, struct image_info *VAR_4)

{

    struct linux_binprm VAR_5;

    int VAR_6;

    int VAR_7;



    VAR_5.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);

    for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++)       

            VAR_5.page[VAR_7] = NULL;

    VAR_6 = open(VAR_0, O_RDONLY);

    if (VAR_6 < 0)

        return VAR_6;

    VAR_5.fd = VAR_6;

    VAR_5.VAR_0 = (char *)VAR_0;

    VAR_5.argc = count(VAR_1);

    VAR_5.VAR_1 = VAR_1;

    VAR_5.envc = count(VAR_2);

    VAR_5.VAR_2 = VAR_2;



    VAR_6 = prepare_binprm(&VAR_5);



    if(VAR_6>=0) {

        if (VAR_5.buf[0] == 0x7f

                && VAR_5.buf[1] == 'E'

                && VAR_5.buf[2] == 'L'

                && VAR_5.buf[3] == 'F') {

            VAR_6 = load_elf_binary(&VAR_5,VAR_3,VAR_4);

        } else {

            fprintf(stderr, "Unknown binary format\n");

            return -1;

        }

    }



    if(VAR_6>=0) {

        

        do_init_thread(VAR_3, VAR_4);

        return VAR_6;

    }



    

    for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++) {

        free(VAR_5.page[VAR_7]);

    }

    return(VAR_6);

}

int FUNC_0(const char * VAR_0, char ** VAR_1, char ** VAR_2,
struct target_pt_regs * VAR_3, struct image_info *VAR_4)
{ struct linux_binprm VAR_5; int VAR_6; int VAR_7; VAR_5.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int); for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++) VAR_5.page[VAR_7] = NULL; VAR_6 = open(VAR_0, O_RDONLY); if (VAR_6 < 0)
return VAR_6; VAR_5.fd = VAR_6; VAR_5.VAR_0 = (char *)VAR_0; VAR_5.argc = count(VAR_1); VAR_5.VAR_1 = VAR_1; VAR_5.envc = count(VAR_2); VAR_5.VAR_2 = VAR_2; VAR_6 = prepare_binprm(&VAR_5); if(VAR_6>=0) { if (VAR_5.buf[0] == 0x7f
&& VAR_5.buf[1] == 'E'
&& VAR_5.buf[2] == 'L'
&& VAR_5.buf[3] == 'F') { VAR_6 = load_elf_binary(&VAR_5,VAR_3,VAR_4); } else { fprintf(stderr, "Unknown binary format\n"); return -1; } } if(VAR_6>=0) { do_init_thread(VAR_3, VAR_4); return VAR_6; } for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++) { free(VAR_5.page[VAR_7]); } return(VAR_6); }