diff mbox series

[v2,08/22] linux-user/riscv: initialise the TaskState heap/stack info

Message ID 20210323165308.15244-9-alex.bennee@linaro.org (mailing list archive)
State New, archived
Headers show
Series fixes for rc1 pre-PR (kernel-doc, semihosting, testing) | expand

Commit Message

Alex Bennée March 23, 2021, 4:52 p.m. UTC
Arguably the target_cpu_copy_regs function for each architecture is
misnamed as a number of the architectures also take the opportunity to
fill out the TaskState structure. This could arguably be factored out
into common code but that would require a wider audit of the
architectures. For now just replicate for riscv so we can correctly
report semihosting information for SYS_HEAPINFO.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210312102029.17017-5-alex.bennee@linaro.org>
Message-Id: <20210320133706.21475-9-alex.bennee@linaro.org>
---
 linux-user/riscv/cpu_loop.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Alistair Francis March 23, 2021, 9:29 p.m. UTC | #1
On Tue, Mar 23, 2021 at 1:07 PM Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Arguably the target_cpu_copy_regs function for each architecture is
> misnamed as a number of the architectures also take the opportunity to
> fill out the TaskState structure. This could arguably be factored out
> into common code but that would require a wider audit of the
> architectures. For now just replicate for riscv so we can correctly
> report semihosting information for SYS_HEAPINFO.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Message-Id: <20210312102029.17017-5-alex.bennee@linaro.org>
> Message-Id: <20210320133706.21475-9-alex.bennee@linaro.org>

Acked-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  linux-user/riscv/cpu_loop.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
> index 6767f941e8..74a9628dc9 100644
> --- a/linux-user/riscv/cpu_loop.c
> +++ b/linux-user/riscv/cpu_loop.c
> @@ -135,4 +135,9 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
>          error_report("Incompatible ELF: RVE cpu requires RVE ABI binary");
>          exit(EXIT_FAILURE);
>      }
> +
> +    ts->stack_base = info->start_stack;
> +    ts->heap_base = info->brk;
> +    /* This will be filled in on the first SYS_HEAPINFO call.  */
> +    ts->heap_limit = 0;
>  }
> --
> 2.20.1
>
>
diff mbox series

Patch

diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index 6767f941e8..74a9628dc9 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -135,4 +135,9 @@  void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
         error_report("Incompatible ELF: RVE cpu requires RVE ABI binary");
         exit(EXIT_FAILURE);
     }
+
+    ts->stack_base = info->start_stack;
+    ts->heap_base = info->brk;
+    /* This will be filled in on the first SYS_HEAPINFO call.  */
+    ts->heap_limit = 0;
 }