[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/14] Avoid declaring the env variable at all i
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] [PATCH 07/14] Avoid declaring the env variable at all if CONFIG_TCG_PASS_AREG0. |
Date: |
Thu, 29 Mar 2012 18:57:52 +0000 |
On Wed, Mar 28, 2012 at 00:32, Richard Henderson <address@hidden> wrote:
> At the same time, remove use of the global ENV from user-exec.c.
>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> Makefile.target | 5 -----
> dyngen-exec.h | 5 +++++
> user-exec.c | 17 ++++++-----------
> 3 files changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/Makefile.target b/Makefile.target
> index aa53e28..81fdf9e 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -110,11 +110,6 @@ $(libobj-y): $(GENERATED_HEADERS)
> ifndef CONFIG_TCG_PASS_AREG0
> op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
> endif
> -user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
> -
> -# Note: this is a workaround. The real fix is to avoid compiling
> -# cpu_signal_handler() in user-exec.c.
> -signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
The patch does not apply, please rebase.
Applying: Avoid declaring the env variable at all if CONFIG_TCG_PASS_AREG0.
error: patch failed: Makefile.target:110
error: Makefile.target: patch does not apply
>
> #########################################################
> # Linux user emulator target
> 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..9691f09 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -18,7 +18,6 @@
> */
> #include "config.h"
> #include "cpu.h"
> -#include "dyngen-exec.h"
> #include "disas.h"
> #include "tcg.h"
>
> @@ -58,8 +57,6 @@ void cpu_resume_from_signal(CPUArchState *env1, void *puc)
> struct sigcontext *uc = puc;
> #endif
>
> - env = env1;
> -
> /* XXX: restore cpu registers saved in host registers */
>
> if (puc) {
> @@ -74,8 +71,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
> @@ -86,12 +83,10 @@ static inline int handle_cpu_signal(unsigned long pc,
> unsigned long address,
> int is_write, sigset_t *old_set,
> void *puc)
> {
> + CPUArchState *env1 = cpu_single_env;
> TranslationBlock *tb;
> int ret;
>
> - if (cpu_single_env) {
> - env = cpu_single_env; /* XXX: find a correct solution for
> multithread */
> - }
> #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);
> @@ -102,7 +97,7 @@ static inline int handle_cpu_signal(unsigned long pc,
> unsigned long address,
> }
>
> /* see if it is an MMU fault */
> - ret = cpu_handle_mmu_fault(env, address, is_write, MMU_USER_IDX);
> + ret = cpu_handle_mmu_fault(env1, address, is_write, MMU_USER_IDX);
> if (ret < 0) {
> return 0; /* not an MMU fault */
> }
> @@ -114,13 +109,13 @@ static inline int handle_cpu_signal(unsigned long pc,
> unsigned long address,
> if (tb) {
> /* the PC is inside the translated code. It means that we have
> a virtual CPU fault */
> - cpu_restore_state(tb, env, pc);
> + cpu_restore_state(tb, env1, pc);
> }
>
> /* we restore the process signal mask as the sigreturn should
> do it (XXX: use sigsetjmp) */
> sigprocmask(SIG_SETMASK, old_set, NULL);
> - exception_action(env);
> + exception_action(env1);
>
> /* never comes here */
> return 1;
> --
> 1.7.7.6
>
- [Qemu-devel] [PATCH 00/14] tcg-sparc improvments, v2, Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 01/14] tcg-sparc: Hack in qemu_ld/st64 for 32-bit., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 02/14] tcg-sparc: Fix ADDX opcode., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 03/14] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 06/14] tcg-sparc: Support GUEST_BASE., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 04/14] tcg-sparc: Fix qemu_ld/st to handle 32-bit host., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 07/14] Avoid declaring the env variable at all if CONFIG_TCG_PASS_AREG0., Richard Henderson, 2012/03/27
- Re: [Qemu-devel] [PATCH 07/14] Avoid declaring the env variable at all if CONFIG_TCG_PASS_AREG0.,
Blue Swirl <=
- [Qemu-devel] [PATCH 09/14] tcg-sparc: Change AREG0 in generated code to %i0., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 05/14] tcg-sparc: Simplify qemu_ld/st direct memory paths., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 08/14] tcg-sparc: Do not use a global register for AREG0., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 10/14] tcg-sparc: Clean up cruft stemming from attempts to use global registers., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 11/14] tcg-sparc: Mask shift immediates to avoid illegal insns., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 14/14] tcg-sparc: Fix and enable direct TB chaining., Richard Henderson, 2012/03/27
- [Qemu-devel] [PATCH 12/14] tcg-sparc: Use defines for temporaries., Richard Henderson, 2012/03/27