[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 05/15] target/arm/arm-semi: Restrict use of T
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v2 05/15] target/arm/arm-semi: Restrict use of TaskState* |
Date: |
Mon, 7 Oct 2019 10:12:19 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/16/19 7:15 AM, Peter Maydell wrote:
> The semihosting code needs accuss to the linux-user only
> TaskState pointer so it can set the semihosting errno per-thread
> for linux-user mode. At the moment we do this by having some
> ifdefs so that we define a 'ts' local in do_arm_semihosting()
> which is either a real TaskState * or just a CPUARMState *,
> depending on which mode we're compiling for.
>
> This is awkward if we want to refactor do_arm_semihosting()
> into other functions which might need to be passed the TaskState.
> Restrict usage of the TaskState local by:
> * making set_swi_errno() always take the CPUARMState pointer
> and (for the linux-user version) get TaskState from that
> * creating a new get_swi_errno() which reads the errno
> * having the two semihosting calls which need the TaskState
> for other purposes (SYS_GET_CMDLINE and SYS_HEAPINFO)
> define a variable with scope restricted to just that code
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> We use 'CPUARMState *', aka 'env', rather than the other
> options of passing the ARMCPU* or the CPUState *, purely
> because it means that the later refactoring of each SYS_*
> can pass just the CPUARMState * and incidentally avoid
> an ugly ifdef caused by the implicit use of env in the
> softmmu lock_user().
> ---
> target/arm/arm-semi.c | 111 ++++++++++++++++++++++++------------------
> 1 file changed, 63 insertions(+), 48 deletions(-)
Reviewed-by: Richard Henderson <address@hidden>
r~
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v2 05/15] target/arm/arm-semi: Restrict use of TaskState*,
Richard Henderson <=