~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to linux-user/linuxload.c

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
116
116
                              abi_ulong stringp, int push_ptr)
117
117
{
 
118
    TaskState *ts = (TaskState *)thread_env->opaque;
118
119
    int n = sizeof(abi_ulong);
119
120
    abi_ulong envp;
120
121
    abi_ulong argv;
133
134
    sp -= n;
134
135
    /* FIXME - handle put_user() failures */
135
136
    put_user_ual(argc, sp);
136
 
 
 
137
    ts->info->arg_start = stringp;
137
138
    while (argc-- > 0) {
138
139
        /* FIXME - handle put_user() failures */
139
140
        put_user_ual(stringp, argv);
140
141
        argv += n;
141
142
        stringp += target_strlen(stringp) + 1;
142
143
    }
 
144
    ts->info->arg_end = stringp;
143
145
    /* FIXME - handle put_user() failures */
144
146
    put_user_ual(0, argv);
145
147
    while (envc-- > 0) {
155
157
}
156
158
 
157
159
int loader_exec(const char * filename, char ** argv, char ** envp,
158
 
             struct target_pt_regs * regs, struct image_info *infop)
 
160
             struct target_pt_regs * regs, struct image_info *infop,
 
161
             struct linux_binprm *bprm)
159
162
{
160
 
    struct linux_binprm bprm;
161
163
    int retval;
162
164
    int i;
163
165
 
164
 
    bprm.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);
 
166
    bprm->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);
165
167
    for (i=0 ; i<MAX_ARG_PAGES ; i++)       /* clear page-table */
166
 
            bprm.page[i] = 0;
 
168
            bprm->page[i] = 0;
167
169
    retval = open(filename, O_RDONLY);
168
170
    if (retval < 0)
169
171
        return retval;
170
 
    bprm.fd = retval;
171
 
    bprm.filename = (char *)filename;
172
 
    bprm.argc = count(argv);
173
 
    bprm.argv = argv;
174
 
    bprm.envc = count(envp);
175
 
    bprm.envp = envp;
 
172
    bprm->fd = retval;
 
173
    bprm->filename = (char *)filename;
 
174
    bprm->argc = count(argv);
 
175
    bprm->argv = argv;
 
176
    bprm->envc = count(envp);
 
177
    bprm->envp = envp;
176
178
 
177
 
    retval = prepare_binprm(&bprm);
 
179
    retval = prepare_binprm(bprm);
178
180
 
179
181
    infop->host_argv = argv;
180
182
 
181
183
    if(retval>=0) {
182
 
        if (bprm.buf[0] == 0x7f
183
 
                && bprm.buf[1] == 'E'
184
 
                && bprm.buf[2] == 'L'
185
 
                && bprm.buf[3] == 'F') {
 
184
        if (bprm->buf[0] == 0x7f
 
185
                && bprm->buf[1] == 'E'
 
186
                && bprm->buf[2] == 'L'
 
187
                && bprm->buf[3] == 'F') {
186
188
#ifndef TARGET_HAS_ELFLOAD32
187
 
            retval = load_elf_binary(&bprm,regs,infop);
 
189
            retval = load_elf_binary(bprm,regs,infop);
188
190
#else
189
 
            retval = load_elf_binary_multi(&bprm, regs, infop);
 
191
            retval = load_elf_binary_multi(bprm, regs, infop);
190
192
#endif
191
193
#if defined(TARGET_HAS_BFLT)
192
 
        } else if (bprm.buf[0] == 'b'
193
 
                && bprm.buf[1] == 'F'
194
 
                && bprm.buf[2] == 'L'
195
 
                && bprm.buf[3] == 'T') {
196
 
            retval = load_flt_binary(&bprm,regs,infop);
 
194
        } else if (bprm->buf[0] == 'b'
 
195
                && bprm->buf[1] == 'F'
 
196
                && bprm->buf[2] == 'L'
 
197
                && bprm->buf[3] == 'T') {
 
198
            retval = load_flt_binary(bprm,regs,infop);
197
199
#endif
198
200
        } else {
199
201
            fprintf(stderr, "Unknown binary format\n");
209
211
 
210
212
    /* Something went wrong, return the inode and free the argument pages*/
211
213
    for (i=0 ; i<MAX_ARG_PAGES ; i++) {
212
 
        free(bprm.page[i]);
 
214
        free(bprm->page[i]);
213
215
    }
214
216
    return(retval);
215
217
}