Received: from eggs.gnu.org ([2001:4830:134:3::10]:49904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VH92G-0004ap-2n for qemu-devel@nongnu.org; Wed, 04 Sep 2013 05:06:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VH924-0007yj-Jb for qemu-devel@nongnu.org; Wed, 04 Sep 2013 05:06:00 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45467 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VH924-0007xs-4P for qemu-devel@nongnu.org; Wed, 04 Sep 2013 05:05:48 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 4 Sep 2013 11:05:09 +0200 Message-Id: <1378285521-3230-30-git-send-email-afaerber@suse.de> In-Reply-To: <1378285521-3230-1-git-send-email-afaerber@suse.de> References: <1378285521-3230-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] [RFC qom-cpu 29/41] cpu-exec: Change cpu_resume_from_signal() argument to CPUState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Max Filippov , =?UTF-8?q?Andreas=20F=C3=A4rber?= Signed-off-by: Andreas F=C3=A4rber --- cpu-exec.c | 4 +--- exec.c | 3 +-- hw/i386/kvmvapic.c | 3 +-- include/exec/exec-all.h | 2 +- target-i386/helper.c | 2 +- target-xtensa/helper.c | 2 +- translate-all.c | 12 ++++++------ user-exec.c | 3 +-- 8 files changed, 13 insertions(+), 18 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index a984b7c..6016a10 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -33,10 +33,8 @@ void cpu_loop_exit(CPUState *cpu) restored in a state compatible with the CPU emulator */ #if defined(CONFIG_SOFTMMU) -void cpu_resume_from_signal(CPUArchState *env, void *puc) +void cpu_resume_from_signal(CPUState *cpu, void *puc) { - CPUState *cpu =3D ENV_GET_CPU(env); - /* XXX: restore cpu registers saved in host registers */ =20 cpu->exception_index =3D -1; diff --git a/exec.c b/exec.c index 7ea864a..5f133e4 100644 --- a/exec.c +++ b/exec.c @@ -1455,7 +1455,6 @@ static const MemoryRegionOps notdirty_mem_ops =3D { static void check_watchpoint(int offset, int len_mask, int flags) { CPUState *cpu =3D current_cpu; - CPUArchState *env =3D cpu->env_ptr; CPUClass *cc =3D CPU_GET_CLASS(cpu); vaddr pc, cs_base; target_ulong vaddr; @@ -1483,7 +1482,7 @@ static void check_watchpoint(int offset, int len_ma= sk, int flags) } else { cc->get_tb_cpu_state(cpu, &pc, &cs_base, &cpu_flags)= ; tb_gen_code(cpu, pc, cs_base, cpu_flags, 1); - cpu_resume_from_signal(env, NULL); + cpu_resume_from_signal(cpu, NULL); } } } else { diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index bcf8d9d..95449f7 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -391,7 +391,6 @@ static void patch_call(VAPICROMState *s, X86CPU *cpu,= target_ulong ip, static void patch_instruction(VAPICROMState *s, X86CPU *cpu, target_ulon= g ip) { CPUState *cs =3D CPU(cpu); - CPUX86State *env =3D &cpu->env; VAPICHandlers *handlers; uint8_t opcode[2]; uint32_t imm32; @@ -451,7 +450,7 @@ static void patch_instruction(VAPICROMState *s, X86CP= U *cpu, target_ulong ip) if (!kvm_enabled()) { cs->current_tb =3D NULL; tb_gen_code(cs, current_pc, current_cs_base, current_flags, 1); - cpu_resume_from_signal(env, NULL); + cpu_resume_from_signal(cs, NULL); } } =20 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 73abf9e..1838ae1 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -82,7 +82,7 @@ int cpu_gen_code(CPUArchState *env, struct TranslationB= lock *tb, int *gen_code_size_ptr); bool cpu_restore_state(CPUState *cpu, uintptr_t searched_pc); =20 -void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc)= ; +void QEMU_NORETURN cpu_resume_from_signal(CPUState *cpu, void *puc); void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, int= flags, diff --git a/target-i386/helper.c b/target-i386/helper.c index 1cd7688..a6d64a6 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1097,7 +1097,7 @@ void breakpoint_handler(CPUX86State *env) if (check_hw_breakpoints(env, false)) { raise_exception(env, EXCP01_DB); } else { - cpu_resume_from_signal(env, NULL); + cpu_resume_from_signal(cs, NULL); } } } else { diff --git a/target-xtensa/helper.c b/target-xtensa/helper.c index c44cf71..9e5af25 100644 --- a/target-xtensa/helper.c +++ b/target-xtensa/helper.c @@ -92,7 +92,7 @@ void xtensa_breakpoint_handler(CPUXtensaState *env) if (cause) { debug_exception_env(env, cause); } - cpu_resume_from_signal(env, NULL); + cpu_resume_from_signal(cs, NULL); } } } diff --git a/translate-all.c b/translate-all.c index 2254b9f..9b62b07 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1002,7 +1002,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t s= tart, tb_page_addr_t end, { TranslationBlock *tb, *tb_next, *saved_tb; CPUState *cpu =3D current_cpu; -#if defined(TARGET_HAS_PRECISE_SMC) || !defined(CONFIG_USER_ONLY) +#if !defined(CONFIG_USER_ONLY) CPUArchState *env =3D NULL; #endif tb_page_addr_t tb_start, tb_end; @@ -1030,7 +1030,9 @@ void tb_invalidate_phys_page_range(tb_page_addr_t s= tart, tb_page_addr_t end, } #if defined(TARGET_HAS_PRECISE_SMC) || !defined(CONFIG_USER_ONLY) if (cpu !=3D NULL) { +#ifndef CONFIG_USER_ONLY env =3D cpu->env_ptr; +#endif #ifdef TARGET_HAS_PRECISE_SMC cc =3D CPU_GET_CLASS(cpu); #endif @@ -1112,7 +1114,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t s= tart, tb_page_addr_t end, itself */ cpu->current_tb =3D NULL; tb_gen_code(cpu, current_pc, current_cs_base, current_flags, 1); - cpu_resume_from_signal(env, NULL); + cpu_resume_from_signal(cpu, NULL); } #endif } @@ -1160,7 +1162,6 @@ static void tb_invalidate_phys_page(tb_page_addr_t = addr, TranslationBlock *current_tb =3D NULL; CPUState *cpu =3D current_cpu; CPUClass *cc =3D NULL; - CPUArchState *env =3D NULL; int current_tb_modified =3D 0; vaddr current_pc =3D 0; vaddr current_cs_base =3D 0; @@ -1178,7 +1179,6 @@ static void tb_invalidate_phys_page(tb_page_addr_t = addr, current_tb =3D tb_find_pc(pc); } if (cpu !=3D NULL) { - env =3D cpu->env_ptr; cc =3D CPU_GET_CLASS(cpu); } #endif @@ -1214,7 +1214,7 @@ static void tb_invalidate_phys_page(tb_page_addr_t = addr, if (locked) { mmap_unlock(); } - cpu_resume_from_signal(env, puc); + cpu_resume_from_signal(cpu, puc); } #endif } @@ -1489,7 +1489,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t reta= ddr) repeating the fault, which is horribly inefficient. Better would be to execute just this insn uncached, or generate a second new TB. */ - cpu_resume_from_signal(env, NULL); + cpu_resume_from_signal(cpu, NULL); } =20 void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr) diff --git a/user-exec.c b/user-exec.c index 75c6d54..3b795c1 100644 --- a/user-exec.c +++ b/user-exec.c @@ -52,9 +52,8 @@ static void exception_action(CPUArchState *env1) /* exit the current TB from a signal handler. The host registers are restored in a state compatible with the CPU emulator */ -void cpu_resume_from_signal(CPUArchState *env1, void *puc) +void cpu_resume_from_signal(CPUState *cpu, void *puc) { - CPUState *cpu =3D ENV_GET_CPU(env1); #ifdef __linux__ struct ucontext *uc =3D puc; #elif defined(__OpenBSD__) --=20 1.8.1.4