Commit 5638d180 authored by Andreas Färber's avatar Andreas Färber

cpu-exec: Change cpu_loop_exit() argument to CPUState

Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
parent d5a11fef
......@@ -23,10 +23,8 @@
#include "qemu/atomic.h"
#include "sysemu/qtest.h"
void cpu_loop_exit(CPUArchState *env)
void cpu_loop_exit(CPUState *cpu)
{
CPUState *cpu = ENV_GET_CPU(env);
cpu->current_tb = NULL;
siglongjmp(cpu->jmp_env, 1);
}
......@@ -325,7 +323,7 @@ int cpu_exec(CPUArchState *env)
if (interrupt_request & CPU_INTERRUPT_DEBUG) {
cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
cpu->exception_index = EXCP_DEBUG;
cpu_loop_exit(env);
cpu_loop_exit(cpu);
}
#if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \
defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \
......@@ -334,7 +332,7 @@ int cpu_exec(CPUArchState *env)
cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
cpu->halted = 1;
cpu->exception_index = EXCP_HLT;
cpu_loop_exit(env);
cpu_loop_exit(cpu);
}
#endif
#if defined(TARGET_I386)
......@@ -349,7 +347,7 @@ int cpu_exec(CPUArchState *env)
0);
do_cpu_init(x86_cpu);
cpu->exception_index = EXCP_HALTED;
cpu_loop_exit(env);
cpu_loop_exit(cpu);
} else if (interrupt_request & CPU_INTERRUPT_SIPI) {
do_cpu_sipi(x86_cpu);
} else if (env->hflags2 & HF2_GIF_MASK) {
......@@ -601,7 +599,7 @@ int cpu_exec(CPUArchState *env)
if (unlikely(cpu->exit_request)) {
cpu->exit_request = 0;
cpu->exception_index = EXCP_INTERRUPT;
cpu_loop_exit(env);
cpu_loop_exit(cpu);
}
spin_lock(&tcg_ctx.tb_ctx.tb_lock);
tb = tb_find_fast(env);
......@@ -672,7 +670,7 @@ int cpu_exec(CPUArchState *env)
}
cpu->exception_index = EXCP_INTERRUPT;
next_tb = 0;
cpu_loop_exit(env);
cpu_loop_exit(cpu);
}
break;
}
......
......@@ -1608,7 +1608,7 @@ static void check_watchpoint(int offset, int len_mask, int flags)
tb_check_watchpoint(env);
if (wp->flags & BP_STOP_BEFORE_ACCESS) {
cpu->exception_index = EXCP_DEBUG;
cpu_loop_exit(env);
cpu_loop_exit(cpu);
} else {
cpu_get_tb_cpu_state(env, &pc, &cs_base, &cpu_flags);
tb_gen_code(env, pc, cs_base, cpu_flags, 1);
......
......@@ -89,7 +89,7 @@ TranslationBlock *tb_gen_code(CPUArchState *env,
target_ulong pc, target_ulong cs_base, int flags,
int cflags);
void cpu_exec_init(CPUArchState *env);
void QEMU_NORETURN cpu_loop_exit(CPUArchState *env1);
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
int is_cpu_write_access);
......
......@@ -513,7 +513,7 @@ void QEMU_NORETURN helper_excp(CPUAlphaState *env, int excp, int error)
cs->exception_index = excp;
env->error_code = error;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
/* This may be called from any of the helpers to set up EXCEPTION_INDEX. */
......@@ -528,7 +528,7 @@ void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr,
if (retaddr) {
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void QEMU_NORETURN arith_excp(CPUAlphaState *env, uintptr_t retaddr,
......
......@@ -116,7 +116,7 @@ static void do_unaligned_access(CPUAlphaState *env, target_ulong addr,
env->trap_arg2 = (insn >> 21) & 31; /* dest regno */
cs->exception_index = EXCP_UNALIGN;
env->error_code = 0;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void alpha_cpu_unassigned_access(CPUState *cs, hwaddr addr,
......@@ -166,7 +166,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write,
cpu_restore_state(env, retaddr);
}
/* Exception index and error code are already set */
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
#endif /* CONFIG_USER_ONLY */
......@@ -28,7 +28,7 @@ static void raise_exception(CPUARMState *env, int tt)
CPUState *cs = CPU(cpu);
cs->exception_index = tt;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
uint32_t HELPER(neon_tbl)(CPUARMState *env, uint32_t ireg, uint32_t def,
......@@ -229,7 +229,7 @@ void HELPER(wfi)(CPUARMState *env)
cs->exception_index = EXCP_HLT;
cs->halted = 1;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void HELPER(wfe)(CPUARMState *env)
......@@ -240,7 +240,7 @@ void HELPER(wfe)(CPUARMState *env)
* level loop
*/
cs->exception_index = EXCP_YIELD;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void HELPER(exception)(CPUARMState *env, uint32_t excp)
......@@ -248,7 +248,7 @@ void HELPER(exception)(CPUARMState *env, uint32_t excp)
CPUState *cs = CPU(arm_env_get_cpu(env));
cs->exception_index = excp;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
uint32_t HELPER(cpsr_read)(CPUARMState *env)
......
......@@ -72,7 +72,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
helper_top_evaluate_flags(env);
}
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
......@@ -83,7 +83,7 @@ void helper_raise_exception(CPUCRISState *env, uint32_t index)
CPUState *cs = CPU(cris_env_get_cpu(env));
cs->exception_index = index;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void helper_tlb_flush_pid(CPUCRISState *env, uint32_t pid)
......
......@@ -108,7 +108,7 @@ static void QEMU_NORETURN raise_interrupt2(CPUX86State *env, int intno,
env->error_code = error_code;
env->exception_is_int = is_int;
env->exception_next_eip = env->eip + next_eip_addend;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
/* shortcuts to generate exceptions */
......
......@@ -569,11 +569,10 @@ void helper_rdmsr(CPUX86State *env)
static void do_pause(X86CPU *cpu)
{
CPUState *cs = CPU(cpu);
CPUX86State *env = &cpu->env;
/* Just let another CPU run. */
cs->exception_index = EXCP_INTERRUPT;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
static void do_hlt(X86CPU *cpu)
......@@ -584,7 +583,7 @@ static void do_hlt(X86CPU *cpu)
env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */
cs->halted = 1;
cs->exception_index = EXCP_HLT;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void helper_hlt(CPUX86State *env, int next_eip_addend)
......@@ -642,5 +641,5 @@ void helper_debug(CPUX86State *env)
CPUState *cs = CPU(x86_env_get_cpu(env));
cs->exception_index = EXCP_DEBUG;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
......@@ -939,7 +939,7 @@ void helper_syscall(CPUX86State *env, int next_eip_addend)
cs->exception_index = EXCP_SYSCALL;
env->exception_next_eip = env->eip + next_eip_addend;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
#else
void helper_syscall(CPUX86State *env, int next_eip_addend)
......
......@@ -334,7 +334,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
env->exception_is_int = 0;
env->exception_next_eip = env->eip;
qemu_log_mask(CPU_LOG_TB_IN_ASM, "NMI");
cpu_loop_exit(env);
cpu_loop_exit(cs);
break;
case SVM_EVTINJ_TYPE_EXEPT:
cs->exception_index = vector;
......@@ -342,7 +342,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
env->exception_is_int = 0;
env->exception_next_eip = -1;
qemu_log_mask(CPU_LOG_TB_IN_ASM, "EXEPT");
cpu_loop_exit(env);
cpu_loop_exit(cs);
break;
case SVM_EVTINJ_TYPE_SOFT:
cs->exception_index = vector;
......@@ -350,7 +350,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
env->exception_is_int = 1;
env->exception_next_eip = env->eip;
qemu_log_mask(CPU_LOG_TB_IN_ASM, "SOFT");
cpu_loop_exit(env);
cpu_loop_exit(cs);
break;
}
qemu_log_mask(CPU_LOG_TB_IN_ASM, " %#x %#x\n", cs->exception_index,
......@@ -772,7 +772,7 @@ void helper_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1)
env->error_code = 0;
env->old_exception = -1;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void cpu_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1)
......
......@@ -28,7 +28,7 @@ void raise_exception(CPULM32State *env, int index)
CPUState *cs = CPU(lm32_env_get_cpu(env));
cs->exception_index = index;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void HELPER(raise_exception)(CPULM32State *env, uint32_t index)
......@@ -42,7 +42,7 @@ void HELPER(hlt)(CPULM32State *env)
cs->halted = 1;
cs->exception_index = EXCP_HLT;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void HELPER(ill)(CPULM32State *env)
......@@ -167,7 +167,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
/* now we have a real cpu fault */
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
#endif
......
......@@ -67,7 +67,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
/* now we have a real cpu fault */
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
......@@ -114,7 +114,7 @@ static void do_interrupt_all(CPUM68KState *env, int is_hw)
}
cs->halted = 1;
cs->exception_index = EXCP_HLT;
cpu_loop_exit(env);
cpu_loop_exit(cs);
return;
}
if (cs->exception_index >= EXCP_TRAP0
......@@ -170,7 +170,7 @@ static void raise_exception(CPUM68KState *env, int tt)
CPUState *cs = CPU(m68k_env_get_cpu(env));
cs->exception_index = tt;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void HELPER(raise_exception)(CPUM68KState *env, uint32_t tt)
......
......@@ -56,7 +56,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
/* now we have a real cpu fault */
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
#endif
......@@ -101,7 +101,7 @@ void helper_raise_exception(CPUMBState *env, uint32_t index)
CPUState *cs = CPU(mb_env_get_cpu(env));
cs->exception_index = index;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void helper_debug(CPUMBState *env)
......
......@@ -51,7 +51,7 @@ static inline void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,
cpu_restore_state(env, pc);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
static inline void QEMU_NORETURN do_raise_exception(CPUMIPSState *env,
......@@ -280,7 +280,7 @@ static inline hwaddr do_translate_address(CPUMIPSState *env,
lladdr = cpu_mips_translate_address(env, address, rw);
if (lladdr == -1LL) {
cpu_loop_exit(env);
cpu_loop_exit(CPU(mips_env_get_cpu(env)));
} else {
return lladdr;
}
......
......@@ -59,7 +59,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
cpu_restore_state(env, retaddr);
}
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void helper_raise_exception(CPUMoxieState *env, int ex)
......@@ -74,7 +74,7 @@ void helper_raise_exception(CPUMoxieState *env, int ex)
env->sregs[5] = env->pc;
/* Jump the the exception handline routine. */
env->pc = env->sregs[1];
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
uint32_t helper_div(CPUMoxieState *env, uint32_t a, uint32_t b)
......@@ -104,7 +104,7 @@ void helper_debug(CPUMoxieState *env)
CPUState *cs = CPU(moxie_env_get_cpu(env));
cs->exception_index = EXCP_DEBUG;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
#if defined(CONFIG_USER_ONLY)
......
......@@ -25,5 +25,5 @@ void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp)
CPUState *cs = CPU(cpu);
cs->exception_index = excp;
cpu_loop_exit(&cpu->env);
cpu_loop_exit(cs);
}
......@@ -52,7 +52,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write,
cpu_restore_state(env, retaddr);
}
/* Raise Exception. */
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
#endif
......@@ -823,7 +823,7 @@ void helper_raise_exception_err(CPUPPCState *env, uint32_t exception,
#endif
cs->exception_index = exception;
env->error_code = error_code;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void helper_raise_exception(CPUPPCState *env, uint32_t exception)
......
......@@ -548,7 +548,7 @@ uint32_t HELPER(calc_cc)(CPUS390XState *env, uint32_t cc_op, uint64_t src,
void HELPER(load_psw)(CPUS390XState *env, uint64_t mask, uint64_t addr)
{
load_psw(env, mask, addr);
cpu_loop_exit(env);
cpu_loop_exit(CPU(s390_env_get_cpu(env)));
}
void HELPER(sacf)(CPUS390XState *env, uint64_t a1)
......
......@@ -58,7 +58,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
/* now we have a real cpu fault */
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
......@@ -971,12 +971,12 @@ static uint32_t mvc_asc(CPUS390XState *env, int64_t l, uint64_t a1,
}
if (mmu_translate(env, a1 & TARGET_PAGE_MASK, 1, mode1, &dest, &flags)) {
cpu_loop_exit(env);
cpu_loop_exit(CPU(s390_env_get_cpu(env)));
}
dest |= a1 & ~TARGET_PAGE_MASK;
if (mmu_translate(env, a2 & TARGET_PAGE_MASK, 0, mode2, &src, &flags)) {
cpu_loop_exit(env);
cpu_loop_exit(CPU(s390_env_get_cpu(env)));
}
src |= a2 & ~TARGET_PAGE_MASK;
......
......@@ -61,7 +61,7 @@ void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp,
env->int_pgm_ilen = t = get_ilen(t);
env->psw.addr += 2 * t;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
/* Raise an exception statically from a TB. */
......@@ -71,7 +71,7 @@ void HELPER(exception)(CPUS390XState *env, uint32_t excp)
HELPER_LOG("%s: exception %d\n", __func__, excp);
cs->exception_index = excp;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
#ifndef CONFIG_USER_ONLY
......@@ -93,7 +93,7 @@ void program_interrupt(CPUS390XState *env, uint32_t code, int ilen)
env->int_pgm_code = code;
env->int_pgm_ilen = ilen;
cs->exception_index = EXCP_PGM;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
......@@ -456,11 +456,11 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1,
#if !defined(CONFIG_USER_ONLY)
case SIGP_RESTART:
qemu_system_reset_request();
cpu_loop_exit(env);
cpu_loop_exit(CPU(s390_env_get_cpu(env)));
break;
case SIGP_STOP:
qemu_system_shutdown_request();
cpu_loop_exit(env);
cpu_loop_exit(CPU(s390_env_get_cpu(env)));
break;
#endif
default:
......
......@@ -52,7 +52,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
if (retaddr) {
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
......@@ -77,7 +77,7 @@ static inline void QEMU_NORETURN raise_exception(CPUSH4State *env, int index,
if (retaddr) {
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void helper_raise_illegal_instruction(CPUSH4State *env)
......
......@@ -27,7 +27,7 @@ void helper_raise_exception(CPUSPARCState *env, int tt)
CPUState *cs = CPU(sparc_env_get_cpu(env));
cs->exception_index = tt;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void helper_debug(CPUSPARCState *env)
......@@ -35,7 +35,7 @@ void helper_debug(CPUSPARCState *env)
CPUState *cs = CPU(sparc_env_get_cpu(env));
cs->exception_index = EXCP_DEBUG;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
#ifdef TARGET_SPARC64
......@@ -239,6 +239,6 @@ void helper_power_down(CPUSPARCState *env)
cs->exception_index = EXCP_HLT;
env->pc = env->npc;
env->npc = env->pc + 4;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
#endif
......@@ -2451,7 +2451,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
if (retaddr) {
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
#endif
......@@ -19,7 +19,7 @@ void HELPER(exception)(CPUUniCore32State *env, uint32_t excp)
CPUState *cs = CPU(uc32_env_get_cpu(env));
cs->exception_index = excp;
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
static target_ulong asr_read(CPUUniCore32State *env)
......@@ -271,7 +271,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write,
/* now we have a real cpu fault */
cpu_restore_state(env, retaddr);
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
}
#endif
......@@ -105,7 +105,7 @@ void HELPER(exception)(CPUXtensaState *env, uint32_t excp)
if (excp == EXCP_DEBUG) {
env->exception_taken = 0;
}
cpu_loop_exit(env);
cpu_loop_exit(cs);
}
void HELPER(exception_cause)(CPUXtensaState *env, uint32_t pc, uint32_t cause)
......@@ -391,7 +391,7 @@ void HELPER(waiti)(CPUXtensaState *env, uint32_t pc, uint32_t intlevel)
(intlevel << PS_INTLEVEL_SHIFT);
check_interrupts(env);
if (env->pending_irq_level) {
cpu_loop_exit(env);
cpu_loop_exit(CPU(xtensa_env_get_cpu(env)));
return;
}
......
......@@ -40,12 +40,12 @@
static void exception_action(CPUArchState *env1)
{
#if defined(TARGET_I386)
CPUState *cpu = ENV_GET_CPU(env1);
#if defined(TARGET_I386)
raise_exception_err(env1, cpu->exception_index, env1->error_code);
#else
cpu_loop_exit(env1);
cpu_loop_exit(cpu);
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment