From bdf7ae5bbdb3f050d97862b2ba0261fa902ebc53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 28 Jun 2013 19:31:32 +0200 Subject: cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Where no extra implementation is needed, fall back to CPUClass::set_pc(). Acked-by: Michael Walle (for lm32) Signed-off-by: Andreas Färber --- target-i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'target-i386/cpu.c') diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 67b095d17f..b57ea4b6f2 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2513,6 +2513,13 @@ static void x86_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.eip = value; } +static void x86_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) +{ + X86CPU *cpu = X86_CPU(cs); + + cpu->env.eip = tb->pc - tb->cs_base; +} + static void x86_cpu_common_class_init(ObjectClass *oc, void *data) { X86CPUClass *xcc = X86_CPU_CLASS(oc); @@ -2530,6 +2537,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->do_interrupt = x86_cpu_do_interrupt; cc->dump_state = x86_cpu_dump_state; cc->set_pc = x86_cpu_set_pc; + cc->synchronize_from_tb = x86_cpu_synchronize_from_tb; cc->get_arch_id = x86_cpu_get_arch_id; cc->get_paging_enabled = x86_cpu_get_paging_enabled; #ifndef CONFIG_USER_ONLY -- cgit v1.2.3