Skip to content

Commit 6f03bef

Browse files
committed
cpu: Move jmp_env field from CPU_COMMON to CPUState
Signed-off-by: Andreas Färber <afaerber@suse.de>
1 parent 8cd7043 commit 6f03bef

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

cpu-exec.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void cpu_loop_exit(CPUArchState *env)
2828
CPUState *cpu = ENV_GET_CPU(env);
2929

3030
cpu->current_tb = NULL;
31-
siglongjmp(env->jmp_env, 1);
31+
siglongjmp(cpu->jmp_env, 1);
3232
}
3333

3434
/* exit the current TB from a signal handler. The host registers are
@@ -37,10 +37,12 @@ void cpu_loop_exit(CPUArchState *env)
3737
#if defined(CONFIG_SOFTMMU)
3838
void cpu_resume_from_signal(CPUArchState *env, void *puc)
3939
{
40+
CPUState *cpu = ENV_GET_CPU(env);
41+
4042
/* XXX: restore cpu registers saved in host registers */
4143

4244
env->exception_index = -1;
43-
siglongjmp(env->jmp_env, 1);
45+
siglongjmp(cpu->jmp_env, 1);
4446
}
4547
#endif
4648

@@ -284,7 +286,7 @@ int cpu_exec(CPUArchState *env)
284286

285287
/* prepare setjmp context for exception handling */
286288
for(;;) {
287-
if (sigsetjmp(env->jmp_env, 0) == 0) {
289+
if (sigsetjmp(cpu->jmp_env, 0) == 0) {
288290
/* if an exception is pending, we execute it here */
289291
if (env->exception_index >= 0) {
290292
if (env->exception_index >= EXCP_INTERRUPT) {

include/exec/cpu-defs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#endif
2525

2626
#include "config.h"
27-
#include <setjmp.h>
2827
#include <inttypes.h>
2928
#include "qemu/osdep.h"
3029
#include "qemu/queue.h"
@@ -141,7 +140,6 @@ typedef struct CPUWatchpoint {
141140
CPUWatchpoint *watchpoint_hit; \
142141
\
143142
/* Core interrupt code */ \
144-
sigjmp_buf jmp_env; \
145143
int exception_index; \
146144
\
147145
/* user data */ \

include/qom/cpu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define QEMU_CPU_H
2222

2323
#include <signal.h>
24+
#include <setjmp.h>
2425
#include "hw/qdev-core.h"
2526
#include "exec/hwaddr.h"
2627
#include "qemu/queue.h"
@@ -216,6 +217,7 @@ struct CPUState {
216217
uint32_t interrupt_request;
217218
int singlestep_enabled;
218219
int64_t icount_extra;
220+
sigjmp_buf jmp_env;
219221

220222
AddressSpace *as;
221223
MemoryListener *tcg_as_listener;

user-exec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static void exception_action(CPUArchState *env1)
5252
*/
5353
void cpu_resume_from_signal(CPUArchState *env1, void *puc)
5454
{
55+
CPUState *cpu = ENV_GET_CPU(env1);
5556
#ifdef __linux__
5657
struct ucontext *uc = puc;
5758
#elif defined(__OpenBSD__)
@@ -71,7 +72,7 @@ void cpu_resume_from_signal(CPUArchState *env1, void *puc)
7172
#endif
7273
}
7374
env1->exception_index = -1;
74-
siglongjmp(env1->jmp_env, 1);
75+
siglongjmp(cpu->jmp_env, 1);
7576
}
7677

7778
/* 'pc' is the host PC at which the exception was raised. 'address' is

0 commit comments

Comments
 (0)