[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/15] Avoid declaring the env variable at all i
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] [PATCH 08/15] Avoid declaring the env variable at all if CONFIG_TCG_PASS_AREG0. |
Date: |
Mon, 26 Mar 2012 16:26:05 +0000 |
On Sun, Mar 25, 2012 at 22:27, Richard Henderson <address@hidden> wrote:
>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> dyngen-exec.h | 5 +++++
> user-exec.c | 17 ++++++++++++++---
> 2 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/dyngen-exec.h b/dyngen-exec.h
> index cfeef99..65fcb43 100644
> --- a/dyngen-exec.h
> +++ b/dyngen-exec.h
> @@ -19,6 +19,10 @@
> #if !defined(__DYNGEN_EXEC_H__)
> #define __DYNGEN_EXEC_H__
>
> +/* If the target has indicated that it does not need an AREG0,
> + don't declare the env variable at all, much less as a register. */
> +#if !defined(CONFIG_TCG_PASS_AREG0)
> +
> #if defined(CONFIG_TCG_INTERPRETER)
> /* The TCG interpreter does not need a special register AREG0,
> * but it is possible to use one by defining AREG0.
> @@ -65,4 +69,5 @@ register CPUArchState *env asm(AREG0);
> extern CPUArchState *env;
> #endif
>
> +#endif /* !CONFIG_TCG_PASS_AREG0 */
> #endif /* !defined(__DYNGEN_EXEC_H__) */
> diff --git a/user-exec.c b/user-exec.c
> index cd905ff..e326104 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -58,7 +58,9 @@ void cpu_resume_from_signal(CPUArchState *env1, void *puc)
> struct sigcontext *uc = puc;
> #endif
>
> +#ifndef CONFIG_TCG_PASS_AREG0
> env = env1;
> +#endif
Shouldn't longjmp() restore global registers as well? Actually, we
return to cpu-exec.c which does not use global env. Isn't this
useless?
>
> /* XXX: restore cpu registers saved in host registers */
>
> @@ -74,8 +76,8 @@ void cpu_resume_from_signal(CPUArchState *env1, void *puc)
> sigprocmask(SIG_SETMASK, &uc->sc_mask, NULL);
> #endif
> }
> - env->exception_index = -1;
> - longjmp(env->jmp_env, 1);
> + env1->exception_index = -1;
> + longjmp(env1->jmp_env, 1);
> }
>
> /* 'pc' is the host PC at which the exception was raised. 'address' is
> @@ -89,9 +91,18 @@ static inline int handle_cpu_signal(unsigned long pc,
> unsigned long address,
> TranslationBlock *tb;
> int ret;
>
> + /* XXX: find a correct solution for multithread */
> +#ifdef CONFIG_TCG_PASS_AREG0
> + /* ??? While we no longer have a global env register, if PC is within
> + the code_gen_buffer then we know that env is within a known register
> + there, and we could have the signal handler extract that value. */
> + CPUArchState *env = cpu_single_env;
This just makes env a useless variable. The original code was trying
to restore the global variable, but the functions called later do not
use global env.
I'd change user-exec.c to work without global env use.
> +#else
> if (cpu_single_env) {
> - env = cpu_single_env; /* XXX: find a correct solution for
> multithread */
> + env = cpu_single_env;
> }
> +#endif
> +
> #if defined(DEBUG_SIGNAL)
> qemu_printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d
> oldset=0x%08lx\n",
> pc, address, is_write, *(unsigned long *)old_set);
> --
> 1.7.7.6
>
- [Qemu-devel] [PATCH 02/15] tcg-sparc: Fix ADDX opcode., (continued)
- [Qemu-devel] [PATCH 02/15] tcg-sparc: Fix ADDX opcode., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 06/15] tcg-sparc: Support GUEST_BASE., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 03/15] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 07/15] tcg-sparc: Steamline qemu_ld/st more., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 09/15] tcg-sparc: Do not use a global register for AREG0., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 05/15] tcg-sparc: Simplify qemu_ld/st direct memory paths., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 04/15] tcg-sparc: Fix qemu_ld/st to handle 32-bit host., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 08/15] Avoid declaring the env variable at all if CONFIG_TCG_PASS_AREG0., Richard Henderson, 2012/03/25
- Re: [Qemu-devel] [PATCH 08/15] Avoid declaring the env variable at all if CONFIG_TCG_PASS_AREG0.,
Blue Swirl <=
- [Qemu-devel] [PATCH 11/15] tcg-sparc: Clean up cruft stemming from attempts to use global registers., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 14/15] tcg-sparc: Add %g/%o registers to alloc_order, Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 10/15] tcg-sparc: Change AREG0 in generated code to %i0., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 12/15] tcg-sparc: Mask shift immediates to avoid illegal insns., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 15/15] tcg-sparc: Fix and enable direct TB chaining., Richard Henderson, 2012/03/25
- [Qemu-devel] [PATCH 13/15] tcg-sparc: Use defines for temporaries., Richard Henderson, 2012/03/25