115
115
abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
116
116
abi_ulong stringp, int push_ptr)
118
TaskState *ts = (TaskState *)thread_env->opaque;
118
119
int n = sizeof(abi_ulong);
134
135
/* FIXME - handle put_user() failures */
135
136
put_user_ual(argc, sp);
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);
141
142
stringp += target_strlen(stringp) + 1;
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) {
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)
160
struct linux_binprm bprm;
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 */
168
bprm->page[i] = NULL;
167
169
retval = open(filename, O_RDONLY);
171
bprm.filename = (char *)filename;
172
bprm.argc = count(argv);
174
bprm.envc = count(envp);
173
bprm->filename = (char *)filename;
174
bprm->argc = count(argv);
176
bprm->envc = count(envp);
177
retval = prepare_binprm(&bprm);
179
retval = prepare_binprm(bprm);
179
181
infop->host_argv = argv;
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);
189
retval = load_elf_binary_multi(&bprm, regs, infop);
191
retval = load_elf_binary_multi(bprm, regs, infop);
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);
199
201
fprintf(stderr, "Unknown binary format\n");