mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
linux-user: Clean up arg_start/arg_end confusion
We had two sets of variables: arg_start/arg_end, and arg_strings/env_strings. In linuxload.c, we set the first pair to the bounds of the argv strings, but in elfload.c, we set the first pair to the bounds of the argv pointers and the second pair to the bounds of the argv strings. Remove arg_start/arg_end, replacing them with the standard argc/argv/envc/envp values. Retain arg_strings/env_strings with the meaning we were using in elfload.c. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/714 Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220427025129.160184-1-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
3757b0d08b
commit
60f1c8017a
5 changed files with 28 additions and 14 deletions
|
@ -1516,8 +1516,8 @@ static inline void init_thread(struct target_pt_regs *regs,
|
|||
regs->iaoq[0] = infop->entry;
|
||||
regs->iaoq[1] = infop->entry + 4;
|
||||
regs->gr[23] = 0;
|
||||
regs->gr[24] = infop->arg_start;
|
||||
regs->gr[25] = (infop->arg_end - infop->arg_start) / sizeof(abi_ulong);
|
||||
regs->gr[24] = infop->argv;
|
||||
regs->gr[25] = infop->argc;
|
||||
/* The top-of-stack contains a linkage buffer. */
|
||||
regs->gr[30] = infop->start_stack + 64;
|
||||
regs->gr[31] = infop->entry;
|
||||
|
@ -2120,8 +2120,10 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
|||
u_envp = u_argv + (argc + 1) * n;
|
||||
u_auxv = u_envp + (envc + 1) * n;
|
||||
info->saved_auxv = u_auxv;
|
||||
info->arg_start = u_argv;
|
||||
info->arg_end = u_argv + argc * n;
|
||||
info->argc = argc;
|
||||
info->envc = envc;
|
||||
info->argv = u_argv;
|
||||
info->envp = u_envp;
|
||||
|
||||
/* This is correct because Linux defines
|
||||
* elf_addr_t as Elf32_Off / Elf64_Off
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue