提交 6f03bef0 编写于 作者: A Andreas Färber

cpu: Move jmp_env field from CPU_COMMON to CPUState

Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 8cd70437
...@@ -28,7 +28,7 @@ void cpu_loop_exit(CPUArchState *env) ...@@ -28,7 +28,7 @@ void cpu_loop_exit(CPUArchState *env)
CPUState *cpu = ENV_GET_CPU(env); CPUState *cpu = ENV_GET_CPU(env);
cpu->current_tb = NULL; cpu->current_tb = NULL;
siglongjmp(env->jmp_env, 1); siglongjmp(cpu->jmp_env, 1);
} }
/* exit the current TB from a signal handler. The host registers are /* exit the current TB from a signal handler. The host registers are
...@@ -37,10 +37,12 @@ void cpu_loop_exit(CPUArchState *env) ...@@ -37,10 +37,12 @@ void cpu_loop_exit(CPUArchState *env)
#if defined(CONFIG_SOFTMMU) #if defined(CONFIG_SOFTMMU)
void cpu_resume_from_signal(CPUArchState *env, void *puc) void cpu_resume_from_signal(CPUArchState *env, void *puc)
{ {
CPUState *cpu = ENV_GET_CPU(env);
/* XXX: restore cpu registers saved in host registers */ /* XXX: restore cpu registers saved in host registers */
env->exception_index = -1; env->exception_index = -1;
siglongjmp(env->jmp_env, 1); siglongjmp(cpu->jmp_env, 1);
} }
#endif #endif
...@@ -284,7 +286,7 @@ int cpu_exec(CPUArchState *env) ...@@ -284,7 +286,7 @@ int cpu_exec(CPUArchState *env)
/* prepare setjmp context for exception handling */ /* prepare setjmp context for exception handling */
for(;;) { for(;;) {
if (sigsetjmp(env->jmp_env, 0) == 0) { if (sigsetjmp(cpu->jmp_env, 0) == 0) {
/* if an exception is pending, we execute it here */ /* if an exception is pending, we execute it here */
if (env->exception_index >= 0) { if (env->exception_index >= 0) {
if (env->exception_index >= EXCP_INTERRUPT) { if (env->exception_index >= EXCP_INTERRUPT) {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#endif #endif
#include "config.h" #include "config.h"
#include <setjmp.h>
#include <inttypes.h> #include <inttypes.h>
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/queue.h" #include "qemu/queue.h"
...@@ -141,7 +140,6 @@ typedef struct CPUWatchpoint { ...@@ -141,7 +140,6 @@ typedef struct CPUWatchpoint {
CPUWatchpoint *watchpoint_hit; \ CPUWatchpoint *watchpoint_hit; \
\ \
/* Core interrupt code */ \ /* Core interrupt code */ \
sigjmp_buf jmp_env; \
int exception_index; \ int exception_index; \
\ \
/* user data */ \ /* user data */ \
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define QEMU_CPU_H #define QEMU_CPU_H
#include <signal.h> #include <signal.h>
#include <setjmp.h>
#include "hw/qdev-core.h" #include "hw/qdev-core.h"
#include "exec/hwaddr.h" #include "exec/hwaddr.h"
#include "qemu/queue.h" #include "qemu/queue.h"
...@@ -216,6 +217,7 @@ struct CPUState { ...@@ -216,6 +217,7 @@ struct CPUState {
uint32_t interrupt_request; uint32_t interrupt_request;
int singlestep_enabled; int singlestep_enabled;
int64_t icount_extra; int64_t icount_extra;
sigjmp_buf jmp_env;
AddressSpace *as; AddressSpace *as;
MemoryListener *tcg_as_listener; MemoryListener *tcg_as_listener;
......
...@@ -52,6 +52,7 @@ static void exception_action(CPUArchState *env1) ...@@ -52,6 +52,7 @@ static void exception_action(CPUArchState *env1)
*/ */
void cpu_resume_from_signal(CPUArchState *env1, void *puc) void cpu_resume_from_signal(CPUArchState *env1, void *puc)
{ {
CPUState *cpu = ENV_GET_CPU(env1);
#ifdef __linux__ #ifdef __linux__
struct ucontext *uc = puc; struct ucontext *uc = puc;
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
...@@ -71,7 +72,7 @@ void cpu_resume_from_signal(CPUArchState *env1, void *puc) ...@@ -71,7 +72,7 @@ void cpu_resume_from_signal(CPUArchState *env1, void *puc)
#endif #endif
} }
env1->exception_index = -1; env1->exception_index = -1;
siglongjmp(env1->jmp_env, 1); siglongjmp(cpu->jmp_env, 1);
} }
/* 'pc' is the host PC at which the exception was raised. 'address' is /* 'pc' is the host PC at which the exception was raised. 'address' is
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册