From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMntA-0000rC-0K for qemu-devel@nongnu.org; Sun, 09 Mar 2014 20:16:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMnt3-0005Aq-U9 for qemu-devel@nongnu.org; Sun, 09 Mar 2014 20:16:15 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42226 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMnt3-0005Ae-IL for qemu-devel@nongnu.org; Sun, 09 Mar 2014 20:16:09 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 10 Mar 2014 01:15:24 +0100 Message-Id: <1394410549-13751-16-git-send-email-afaerber@suse.de> In-Reply-To: <1394410549-13751-1-git-send-email-afaerber@suse.de> References: <1394410549-13751-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-cpu v2 15/40] cpu: Move jmp_env field from CPU_COMMON to CPUState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= Signed-off-by: Andreas F=C3=A4rber --- cpu-exec.c | 8 +++++--- include/exec/cpu-defs.h | 2 -- include/qom/cpu.h | 2 ++ user-exec.c | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index dd8da53..3e17ff5 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -28,7 +28,7 @@ void cpu_loop_exit(CPUArchState *env) CPUState *cpu =3D ENV_GET_CPU(env); =20 cpu->current_tb =3D NULL; - siglongjmp(env->jmp_env, 1); + siglongjmp(cpu->jmp_env, 1); } =20 /* exit the current TB from a signal handler. The host registers are @@ -37,10 +37,12 @@ void cpu_loop_exit(CPUArchState *env) #if defined(CONFIG_SOFTMMU) void cpu_resume_from_signal(CPUArchState *env, void *puc) { + CPUState *cpu =3D ENV_GET_CPU(env); + /* XXX: restore cpu registers saved in host registers */ =20 env->exception_index =3D -1; - siglongjmp(env->jmp_env, 1); + siglongjmp(cpu->jmp_env, 1); } #endif =20 @@ -284,7 +286,7 @@ int cpu_exec(CPUArchState *env) =20 /* prepare setjmp context for exception handling */ for(;;) { - if (sigsetjmp(env->jmp_env, 0) =3D=3D 0) { + if (sigsetjmp(cpu->jmp_env, 0) =3D=3D 0) { /* if an exception is pending, we execute it here */ if (env->exception_index >=3D 0) { if (env->exception_index >=3D EXCP_INTERRUPT) { diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index 2ba3df7..dfb1289 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -24,7 +24,6 @@ #endif =20 #include "config.h" -#include #include #include "qemu/osdep.h" #include "qemu/queue.h" @@ -140,7 +139,6 @@ typedef struct CPUWatchpoint { CPUWatchpoint *watchpoint_hit; = \ = \ /* Core interrupt code */ = \ - sigjmp_buf jmp_env; = \ int exception_index; = \ = \ /* user data */ = \ diff --git a/include/qom/cpu.h b/include/qom/cpu.h index ada8a5a..04bfd72 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -21,6 +21,7 @@ #define QEMU_CPU_H =20 #include +#include #include "hw/qdev-core.h" #include "exec/hwaddr.h" #include "qemu/queue.h" @@ -216,6 +217,7 @@ struct CPUState { uint32_t interrupt_request; int singlestep_enabled; int64_t icount_extra; + sigjmp_buf jmp_env; =20 AddressSpace *as; MemoryListener *tcg_as_listener; diff --git a/user-exec.c b/user-exec.c index d850d41..dec636e 100644 --- a/user-exec.c +++ b/user-exec.c @@ -52,6 +52,7 @@ static void exception_action(CPUArchState *env1) */ void cpu_resume_from_signal(CPUArchState *env1, void *puc) { + CPUState *cpu =3D ENV_GET_CPU(env1); #ifdef __linux__ struct ucontext *uc =3D puc; #elif defined(__OpenBSD__) @@ -71,7 +72,7 @@ void cpu_resume_from_signal(CPUArchState *env1, void *p= uc) #endif } env1->exception_index =3D -1; - siglongjmp(env1->jmp_env, 1); + siglongjmp(cpu->jmp_env, 1); } =20 /* 'pc' is the host PC at which the exception was raised. 'address' is --=20 1.8.4.5