bsd-user: pass the bsd_param into loader_exec

Pass the bsd_param into loader_exec, and adjust. We use it to track the
inital stack allocation and to set stack, open files, and other state
shared between bsdload.c and elfload.c

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
Warner Losh 2021-04-29 18:45:13 -06:00
parent 66ef252fab
commit d37853f92f
3 changed files with 27 additions and 20 deletions

View file

@ -343,6 +343,7 @@ int main(int argc, char **argv)
const char *log_mask = NULL;
struct target_pt_regs regs1, *regs = &regs1;
struct image_info info1, *info = &info1;
struct bsd_binprm bprm;
TaskState ts1, *ts = &ts1;
CPUArchState *env;
CPUState *cpu;
@ -499,6 +500,9 @@ int main(int argc, char **argv)
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));
/* Zero bsd params */
memset(&bprm, 0, sizeof(bprm));
/* Zero out image_info */
memset(info, 0, sizeof(struct image_info));
@ -566,7 +570,8 @@ int main(int argc, char **argv)
}
}
if (loader_exec(filename, argv + optind, target_environ, regs, info) != 0) {
if (loader_exec(filename, argv + optind, target_environ, regs, info,
&bprm) != 0) {
printf("Error loading %s\n", filename);
_exit(1);
}