From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMntO-0001Kz-Eu for qemu-devel@nongnu.org; Sun, 09 Mar 2014 20:16:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMntI-0005FL-5S for qemu-devel@nongnu.org; Sun, 09 Mar 2014 20:16:30 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42294 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMntH-0005F5-Rm for qemu-devel@nongnu.org; Sun, 09 Mar 2014 20:16:24 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 10 Mar 2014 01:15:35 +0100 Message-Id: <1394410549-13751-27-git-send-email-afaerber@suse.de> In-Reply-To: <1394410549-13751-1-git-send-email-afaerber@suse.de> References: <1394410549-13751-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] [PATCH qom-cpu v2 26/40] translate-all: Change tb_gen_code() argument to CPUState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori , "Michael S. Tsirkin" Signed-off-by: Andreas F=C3=A4rber --- cpu-exec.c | 4 ++-- exec.c | 2 +- hw/i386/kvmvapic.c | 2 +- include/exec/exec-all.h | 2 +- translate-all.c | 9 +++++---- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 192620f..c689ef9 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -103,7 +103,7 @@ static void cpu_exec_nocache(CPUArchState *env, int m= ax_cycles, if (max_cycles > CF_COUNT_MASK) max_cycles =3D CF_COUNT_MASK; =20 - tb =3D tb_gen_code(env, orig_tb->pc, orig_tb->cs_base, orig_tb->flag= s, + tb =3D tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flag= s, max_cycles); cpu->current_tb =3D tb; /* execute the generated code */ @@ -156,7 +156,7 @@ static TranslationBlock *tb_find_slow(CPUArchState *e= nv, } not_found: /* if no translated code available, then translate it now */ - tb =3D tb_gen_code(env, pc, cs_base, flags, 0); + tb =3D tb_gen_code(cpu, pc, cs_base, flags, 0); =20 found: /* Move the last found TB to the head of the list */ diff --git a/exec.c b/exec.c index dfa43a5..6b2b9ac 100644 --- a/exec.c +++ b/exec.c @@ -1605,7 +1605,7 @@ static void check_watchpoint(int offset, int len_ma= sk, int flags) 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); + tb_gen_code(cpu, pc, cs_base, cpu_flags, 1); cpu_resume_from_signal(env, NULL); } } diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index 39d516a..2a9d87a 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -448,7 +448,7 @@ static void patch_instruction(VAPICROMState *s, X86CP= U *cpu, target_ulong ip) =20 if (!kvm_enabled()) { cs->current_tb =3D NULL; - tb_gen_code(env, current_pc, current_cs_base, current_flags, 1); + tb_gen_code(cs, current_pc, current_cs_base, current_flags, 1); cpu_resume_from_signal(env, NULL); } } diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 727dc3c..a3e7faa 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -85,7 +85,7 @@ void page_size_init(void); =20 void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc)= ; void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); -TranslationBlock *tb_gen_code(CPUArchState *env,=20 +TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, int= flags, int cflags); void cpu_exec_init(CPUArchState *env); diff --git a/translate-all.c b/translate-all.c index 83c7907..a7130a5 100644 --- a/translate-all.c +++ b/translate-all.c @@ -938,10 +938,11 @@ static void build_page_bitmap(PageDesc *p) } } =20 -TranslationBlock *tb_gen_code(CPUArchState *env, +TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, int flags, int cflags) { + CPUArchState *env =3D cpu->env_ptr; TranslationBlock *tb; uint8_t *tc_ptr; tb_page_addr_t phys_pc, phys_page2; @@ -1111,7 +1112,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t s= tart, tb_page_addr_t end, modifying the memory. It will ensure that it cannot modify itself */ cpu->current_tb =3D NULL; - tb_gen_code(env, current_pc, current_cs_base, current_flags, 1); + tb_gen_code(cpu, current_pc, current_cs_base, current_flags, 1); cpu_resume_from_signal(env, NULL); } #endif @@ -1208,7 +1209,7 @@ static void tb_invalidate_phys_page(tb_page_addr_t = addr, modifying the memory. It will ensure that it cannot modify itself */ cpu->current_tb =3D NULL; - tb_gen_code(env, current_pc, current_cs_base, current_flags, 1); + tb_gen_code(cpu, current_pc, current_cs_base, current_flags, 1); if (locked) { mmap_unlock(); } @@ -1469,7 +1470,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t reta= ddr) tb_phys_invalidate(tb, -1); /* FIXME: In theory this could raise an exception. In practice we have already translated the block once so it's probably ok. *= / - tb_gen_code(env, pc, cs_base, flags, cflags); + tb_gen_code(cpu, pc, cs_base, flags, cflags); /* TODO: If env->pc !=3D tb->pc (i.e. the faulting instruction was n= ot the first in the TB) then we end up generating a whole new TB and repeating the fault, which is horribly inefficient. --=20 1.8.4.5