From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, "Andreas Färber" <afaerber@suse.de>,
"Anthony Liguori" <aliguori@amazon.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH qom-cpu v2 26/40] translate-all: Change tb_gen_code() argument to CPUState
Date: Mon, 10 Mar 2014 01:15:35 +0100 [thread overview]
Message-ID: <1394410549-13751-27-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1394410549-13751-1-git-send-email-afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
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 max_cycles,
if (max_cycles > CF_COUNT_MASK)
max_cycles = CF_COUNT_MASK;
- tb = tb_gen_code(env, orig_tb->pc, orig_tb->cs_base, orig_tb->flags,
+ tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags,
max_cycles);
cpu->current_tb = tb;
/* execute the generated code */
@@ -156,7 +156,7 @@ static TranslationBlock *tb_find_slow(CPUArchState *env,
}
not_found:
/* if no translated code available, then translate it now */
- tb = tb_gen_code(env, pc, cs_base, flags, 0);
+ tb = tb_gen_code(cpu, pc, cs_base, flags, 0);
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_mask, 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, X86CPU *cpu, target_ulong ip)
if (!kvm_enabled()) {
cs->current_tb = 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);
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,
+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)
}
}
-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 = 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 start, tb_page_addr_t end,
modifying the memory. It will ensure that it cannot modify
itself */
cpu->current_tb = 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 = 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 retaddr)
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 != tb->pc (i.e. the faulting instruction was not
the first in the TB) then we end up generating a whole new TB and
repeating the fault, which is horribly inefficient.
--
1.8.4.5
next prev parent reply other threads:[~2014-03-10 0:16 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 0:15 [Qemu-devel] [PATCH qom-cpu v2 00/40] QOM CPUState, part 13: Emptying CPU_COMMON Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 01/40] target-alpha: Clean up ENV_GET_CPU() usage Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 02/40] target-arm: " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 03/40] target-i386: " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 04/40] target-ppc: " Andreas Färber
2014-03-12 22:56 ` Stuart Brady
2014-03-12 23:53 ` Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 05/40] target-s390x: " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 06/40] target-sparc: " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 07/40] target-unicore32: " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 08/40] target-xtensa: " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 09/40] cpu: Turn cpu_handle_mmu_fault() into a CPUClass hook Andreas Färber
2014-03-10 7:52 ` Paolo Bonzini
2014-03-11 23:47 ` Andreas Färber
2014-03-12 17:58 ` Paolo Bonzini
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 10/40] cpu: Move mem_io_{pc, vaddr} fields from CPU_COMMON to CPUState Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 11/40] cpu: Move can_do_io field " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 12/40] cpu: Move icount_extra " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 13/40] cpu: Move icount_decr " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 14/40] cpu: Move tb_jmp_cache " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 15/40] cpu: Move jmp_env " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 16/40] cpu: Move exception_index " Andreas Färber
2014-03-11 22:29 ` Andreas Färber
2014-03-13 0:56 ` Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 17/40] cpu: Move opaque " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 18/40] cpu: Move watchpoint fields " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 19/40] cpu: Move breakpoints field " Andreas Färber
2014-03-12 23:08 ` Stuart Brady
2014-03-12 23:59 ` Andreas Färber
2014-03-13 0:40 ` Stuart Brady
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 20/40] exec: Change tlb_fill() argument " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 21/40] cpu-exec: Change cpu_loop_exit() " Andreas Färber
2014-03-11 22:35 ` Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 22/40] translate-all: Change cpu_restore_state() " Andreas Färber
2014-03-11 15:02 ` Max Filippov
2014-03-11 23:23 ` Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 23/40] translate-all: Change cpu_restore_state_from_tb() " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 24/40] translate-all: Change tb_check_watchpoint() " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 25/40] translate-all: Change cpu_io_recompile() " Andreas Färber
2014-03-10 0:15 ` Andreas Färber [this message]
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 27/40] translate-all: Change tb_flush_jmp_cache() " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 28/40] target-ppc: Use PowerPCCPU in PowerPCCPUClass::handle_mmu_fault hook Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 29/40] exec: Change cpu_watchpoint_{insert, remove{, _by_ref, _all}} argument Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 30/40] exec: Change cpu_breakpoint_{insert, " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 31/40] cpu-exec: Change cpu_resume_from_signal() argument to CPUState Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 32/40] cputlb: Change tlb_unprotect_code_phys() " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 33/40] exec: Change memory_region_section_get_iotlb() " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 34/40] exec: Change cpu_abort() " Andreas Färber
2014-03-12 23:28 ` Andreas Färber
2014-03-13 0:59 ` Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 35/40] target-cris: Replace DisasContext::env field with CRISCPU Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 36/40] target-microblaze: Replace DisasContext::env field with MicroBlazeCPU Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 37/40] cputlb: Change tlb_flush_page() argument to CPUState Andreas Färber
2014-03-11 15:05 ` Max Filippov
2014-03-13 0:33 ` Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 38/40] cputlb: Change tlb_flush() " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 39/40] cputlb: Change tlb_set_page() " Andreas Färber
2014-03-10 0:15 ` [Qemu-devel] [PATCH qom-cpu v2 40/40] user-exec: Change exception_action() " Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394410549-13751-27-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).