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

cpu: Move exit_request field to CPUState

Since it was located before breakpoints field, it needs to be reset.
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 0315c31c
...@@ -196,7 +196,7 @@ int cpu_exec(CPUArchState *env) ...@@ -196,7 +196,7 @@ int cpu_exec(CPUArchState *env)
cpu_single_env = env; cpu_single_env = env;
if (unlikely(exit_request)) { if (unlikely(exit_request)) {
env->exit_request = 1; cpu->exit_request = 1;
} }
#if defined(TARGET_I386) #if defined(TARGET_I386)
...@@ -537,8 +537,8 @@ int cpu_exec(CPUArchState *env) ...@@ -537,8 +537,8 @@ int cpu_exec(CPUArchState *env)
next_tb = 0; next_tb = 0;
} }
} }
if (unlikely(env->exit_request)) { if (unlikely(cpu->exit_request)) {
env->exit_request = 0; cpu->exit_request = 0;
env->exception_index = EXCP_INTERRUPT; env->exception_index = EXCP_INTERRUPT;
cpu_loop_exit(env); cpu_loop_exit(env);
} }
...@@ -591,7 +591,7 @@ int cpu_exec(CPUArchState *env) ...@@ -591,7 +591,7 @@ int cpu_exec(CPUArchState *env)
starting execution if there is a pending interrupt. */ starting execution if there is a pending interrupt. */
env->current_tb = tb; env->current_tb = tb;
barrier(); barrier();
if (likely(!env->exit_request)) { if (likely(!cpu->exit_request)) {
tc_ptr = tb->tc_ptr; tc_ptr = tb->tc_ptr;
/* execute the generated code */ /* execute the generated code */
next_tb = tcg_qemu_tb_exec(env, tc_ptr); next_tb = tcg_qemu_tb_exec(env, tc_ptr);
......
...@@ -492,7 +492,9 @@ void cpu_reset_interrupt(CPUArchState *env, int mask) ...@@ -492,7 +492,9 @@ void cpu_reset_interrupt(CPUArchState *env, int mask)
void cpu_exit(CPUArchState *env) void cpu_exit(CPUArchState *env)
{ {
env->exit_request = 1; CPUState *cpu = ENV_GET_CPU(env);
cpu->exit_request = 1;
cpu_unlink_tb(env); cpu_unlink_tb(env);
} }
......
...@@ -513,13 +513,14 @@ static target_ulong h_cede(PowerPCCPU *cpu, sPAPREnvironment *spapr, ...@@ -513,13 +513,14 @@ static target_ulong h_cede(PowerPCCPU *cpu, sPAPREnvironment *spapr,
target_ulong opcode, target_ulong *args) target_ulong opcode, target_ulong *args)
{ {
CPUPPCState *env = &cpu->env; CPUPPCState *env = &cpu->env;
CPUState *cs = CPU(cpu);
env->msr |= (1ULL << MSR_EE); env->msr |= (1ULL << MSR_EE);
hreg_compute_hflags(env); hreg_compute_hflags(env);
if (!cpu_has_work(CPU(cpu))) { if (!cpu_has_work(cs)) {
env->halted = 1; env->halted = 1;
env->exception_index = EXCP_HLT; env->exception_index = EXCP_HLT;
env->exit_request = 1; cs->exit_request = 1;
} }
return H_SUCCESS; return H_SUCCESS;
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "config.h" #include "config.h"
#include <setjmp.h> #include <setjmp.h>
#include <inttypes.h> #include <inttypes.h>
#include <signal.h>
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/queue.h" #include "qemu/queue.h"
#include "exec/hwaddr.h" #include "exec/hwaddr.h"
...@@ -160,7 +159,6 @@ typedef struct CPUWatchpoint { ...@@ -160,7 +159,6 @@ typedef struct CPUWatchpoint {
memory was accessed */ \ memory was accessed */ \
uint32_t halted; /* Nonzero if the CPU is in suspend state */ \ uint32_t halted; /* Nonzero if the CPU is in suspend state */ \
uint32_t interrupt_request; \ uint32_t interrupt_request; \
volatile sig_atomic_t exit_request; \
CPU_COMMON_TLB \ CPU_COMMON_TLB \
struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; \ struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; \
/* buffer for temporaries in the code generator */ \ /* buffer for temporaries in the code generator */ \
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#ifndef QEMU_CPU_H #ifndef QEMU_CPU_H
#define QEMU_CPU_H #define QEMU_CPU_H
#include <signal.h>
#include "hw/qdev-core.h" #include "hw/qdev-core.h"
#include "qemu/thread.h" #include "qemu/thread.h"
...@@ -96,6 +97,7 @@ struct CPUState { ...@@ -96,6 +97,7 @@ struct CPUState {
bool created; bool created;
bool stop; bool stop;
bool stopped; bool stopped;
volatile sig_atomic_t exit_request;
int kvm_fd; int kvm_fd;
bool kvm_vcpu_dirty; bool kvm_vcpu_dirty;
......
...@@ -1537,7 +1537,7 @@ int kvm_cpu_exec(CPUArchState *env) ...@@ -1537,7 +1537,7 @@ int kvm_cpu_exec(CPUArchState *env)
DPRINTF("kvm_cpu_exec()\n"); DPRINTF("kvm_cpu_exec()\n");
if (kvm_arch_process_async_events(cpu)) { if (kvm_arch_process_async_events(cpu)) {
env->exit_request = 0; cpu->exit_request = 0;
return EXCP_HLT; return EXCP_HLT;
} }
...@@ -1548,7 +1548,7 @@ int kvm_cpu_exec(CPUArchState *env) ...@@ -1548,7 +1548,7 @@ int kvm_cpu_exec(CPUArchState *env)
} }
kvm_arch_pre_run(cpu, run); kvm_arch_pre_run(cpu, run);
if (env->exit_request) { if (cpu->exit_request) {
DPRINTF("interrupt exit requested\n"); DPRINTF("interrupt exit requested\n");
/* /*
* KVM requires us to reenter the kernel after IO exits to complete * KVM requires us to reenter the kernel after IO exits to complete
...@@ -1622,7 +1622,7 @@ int kvm_cpu_exec(CPUArchState *env) ...@@ -1622,7 +1622,7 @@ int kvm_cpu_exec(CPUArchState *env)
vm_stop(RUN_STATE_INTERNAL_ERROR); vm_stop(RUN_STATE_INTERNAL_ERROR);
} }
env->exit_request = 0; cpu->exit_request = 0;
return ret; return ret;
} }
......
...@@ -32,6 +32,7 @@ void cpu_reset(CPUState *cpu) ...@@ -32,6 +32,7 @@ void cpu_reset(CPUState *cpu)
static void cpu_common_reset(CPUState *cpu) static void cpu_common_reset(CPUState *cpu)
{ {
cpu->exit_request = 0;
} }
ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model) ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
......
...@@ -1777,7 +1777,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) ...@@ -1777,7 +1777,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run)
* or pending TPR access reports. */ * or pending TPR access reports. */
if (env->interrupt_request & if (env->interrupt_request &
(CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) {
env->exit_request = 1; cpu->exit_request = 1;
} }
/* Try to inject an interrupt if the guest can accept it */ /* Try to inject an interrupt if the guest can accept it */
...@@ -1847,7 +1847,7 @@ int kvm_arch_process_async_events(CPUState *cs) ...@@ -1847,7 +1847,7 @@ int kvm_arch_process_async_events(CPUState *cs)
if (env->exception_injected == EXCP08_DBLE) { if (env->exception_injected == EXCP08_DBLE) {
/* this means triple fault */ /* this means triple fault */
qemu_system_reset_request(); qemu_system_reset_request();
env->exit_request = 1; cs->exit_request = 1;
return 0; return 0;
} }
env->exception_injected = EXCP12_MCHK; env->exception_injected = EXCP12_MCHK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册