[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/19] include/exec: Move tb hash functions out
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 06/19] include/exec: Move tb hash functions out |
Date: |
Mon, 6 Jul 2015 14:34:55 +0200 |
From: Peter Crosthwaite <address@hidden>
This is one of very few things in exec-all with a genuine CPU
architecture dependency. Move these hashing helpers to a new
header to trim exec-all.h down to a near architecture-agnostic
header.
The defs are only used by cpu-exec and translate-all which are both
arch-obj's so the new tb-hash.h has no core code usage.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpu-exec.c | 1 +
include/exec/exec-all.h | 20 --------------------
include/exec/tb-hash.h | 43 +++++++++++++++++++++++++++++++++++++++++++
translate-all.c | 1 +
4 files changed, 45 insertions(+), 20 deletions(-)
create mode 100644 include/exec/tb-hash.h
diff --git a/cpu-exec.c b/cpu-exec.c
index 2ffeb6e..b2724c1 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -27,6 +27,7 @@
#include "exec/address-spaces.h"
#include "exec/memory-internal.h"
#include "qemu/rcu.h"
+#include "exec/tb-hash.h"
/* -icount align implementation. */
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 2573e8c..d678114 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -195,26 +195,6 @@ struct TBContext {
int tb_invalidated_flag;
};
-static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
-{
- target_ulong tmp;
- tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
- return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
-}
-
-static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
-{
- target_ulong tmp;
- tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
- return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
- | (tmp & TB_JMP_ADDR_MASK));
-}
-
-static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
-{
- return (pc >> 2) & (CODE_GEN_PHYS_HASH_SIZE - 1);
-}
-
void tb_free(TranslationBlock *tb);
void tb_flush(CPUArchState *env);
void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h
new file mode 100644
index 0000000..e0bd786
--- /dev/null
+++ b/include/exec/tb-hash.h
@@ -0,0 +1,43 @@
+/*
+ * internal execution defines for qemu
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef EXEC_TB_HASH
+#define EXEC_TB_HASH
+
+static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
+{
+ target_ulong tmp;
+ tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
+ return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
+}
+
+static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
+{
+ target_ulong tmp;
+ tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
+ return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
+ | (tmp & TB_JMP_ADDR_MASK));
+}
+
+static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
+{
+ return (pc >> 2) & (CODE_GEN_PHYS_HASH_SIZE - 1);
+}
+
+#endif
diff --git a/translate-all.c b/translate-all.c
index b6b0e1c..412bc90 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -58,6 +58,7 @@
#endif
#include "exec/cputlb.h"
+#include "exec/tb-hash.h"
#include "translate-all.h"
#include "qemu/bitmap.h"
#include "qemu/timer.h"
--
2.4.3
- [Qemu-devel] [PULL 00/19] Multithread, multiarch, multicompiler, multi^WKVM changes for 2015-07-06, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 02/19] cutils: allow compilation with icc, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 01/19] qemu-common: add VEC_OR macro, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 04/19] cpu-defs: Move CPU_TEMP_BUF_NLONGS to tcg, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 05/19] include/exec: Move standard exceptions to cpu-all.h, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 07/19] cpu-defs: Move out TB_JMP defines, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 03/19] memory_mapping: Rework cpu related includes, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 06/19] include/exec: Move tb hash functions out,
Paolo Bonzini <=
- [Qemu-devel] [PULL 08/19] Fix irq route entries exceeding KVM_MAX_IRQ_ROUTES, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 09/19] main-loop: use qemu_mutex_lock_iothread consistently, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 11/19] memory: Add global-locking property to memory regions, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 12/19] exec: pull qemu_flush_coalesced_mmio_buffer() into address_space_rw/ld*/st*, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 13/19] memory: let address_space_rw/ld*/st* run outside the BQL, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 10/19] main-loop: introduce qemu_mutex_iothread_locked, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 15/19] kvm: Switch to unlocked PIO, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 14/19] kvm: First step to push iothread lock out of inner run loop, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 16/19] acpi: mark PMTIMER as unlocked, Paolo Bonzini, 2015/07/06
- [Qemu-devel] [PULL 19/19] exec: skip MMIO regions correctly in cpu_physical_memory_write_rom_internal, Paolo Bonzini, 2015/07/06