[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/4] softmmu: add a faster helper for TCG
From: |
Blue Swirl |
Subject: |
[Qemu-devel] [PATCH 4/4] softmmu: add a faster helper for TCG |
Date: |
Mon, 9 Apr 2012 19:48:10 +0000 |
Don't recheck the TLB miss which we know is true, instead
call directly the miss path.
Signed-off-by: Blue Swirl <address@hidden>
---
softmmu_template.h | 40 ++++++++++++++++++++++++++++++++++++++++
tcg/arm/tcg-target.c | 19 ++++++++++---------
tcg/hppa/tcg-target.c | 17 +++++++++--------
tcg/i386/tcg-target.c | 17 +++++++++--------
tcg/ia64/tcg-target.c | 17 +++++++++--------
tcg/mips/tcg-target.c | 17 +++++++++--------
tcg/ppc/tcg-target.c | 17 +++++++++--------
tcg/ppc64/tcg-target.c | 17 +++++++++--------
tcg/s390/tcg-target.c | 17 +++++++++--------
tcg/sparc/tcg-target.c | 17 +++++++++--------
10 files changed, 122 insertions(+), 73 deletions(-)
diff --git a/softmmu_template.h b/softmmu_template.h
index dcafacd..6dcc3d4 100644
--- a/softmmu_template.h
+++ b/softmmu_template.h
@@ -165,6 +165,26 @@ glue(glue(glue(HELPER_PREFIX, ld), SUFFIX),
MMUSUFFIX)(ENV_PARAM
return res;
}
+#if defined(CONFIG_TCG_PASS_AREG0) && defined(GEN_TCG_HELPER)
+/* We know that the page was not in TLB, fill and retry */
+static DATA_TYPE
+glue(tcg_helper_qemu_ld, SUFFIX)(CPUArchState *env, target_ulong addr,
+ int mmu_idx)
+{
+ void *retaddr;
+
+ retaddr = GETPC();
+#ifdef TARGET_ALIGNED_ONLY
+ if ((addr & (DATA_SIZE - 1)) != 0) {
+ cpu_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx,
+ retaddr);
+ }
+#endif
+ tlb_fill(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
+ return glue(glue(helper_ld, SUFFIX), MMUSUFFIX)(env, addr, mmu_idx);
+}
+#endif
+
/* handle all unaligned cases */
static DATA_TYPE
glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(ENV_PARAM
@@ -310,6 +330,26 @@ void glue(glue(glue(HELPER_PREFIX, st), SUFFIX),
MMUSUFFIX)(ENV_PARAM
}
}
+#if defined(CONFIG_TCG_PASS_AREG0) && defined(GEN_TCG_HELPER)
+/* We know that the page was not in TLB, fill and retry */
+static void
+glue(tcg_helper_qemu_st, SUFFIX)(CPUArchState *env, target_ulong addr,
+ DATA_TYPE val, int mmu_idx)
+{
+ void *retaddr;
+
+ retaddr = GETPC();
+#ifdef TARGET_ALIGNED_ONLY
+ if ((addr & (DATA_SIZE - 1)) != 0) {
+ cpu_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx,
+ retaddr);
+ }
+#endif
+ tlb_fill(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
+ glue(glue(helper_st, SUFFIX), MMUSUFFIX)(env, addr, val, mmu_idx);
+}
+#endif
+
/* handles all unaligned cases */
static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(ENV_PARAM
target_ulong addr,
diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
index 99853dd..7282691 100644
--- a/tcg/arm/tcg-target.c
+++ b/tcg/arm/tcg-target.c
@@ -931,6 +931,7 @@ static inline void tcg_out_goto_label(TCGContext
*s, int cond, int label_index)
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -946,20 +947,20 @@ static inline void tcg_out_goto_label(TCGContext
*s, int cond, int label_index)
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
-static const void * const qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+static const void *qemu_ld_helpers[4] = {
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void * const qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c
index abb7312..fd25da2 100644
--- a/tcg/hppa/tcg-target.c
+++ b/tcg/hppa/tcg-target.c
@@ -884,6 +884,7 @@ static void tcg_out_setcond2(TCGContext *s, int
cond, TCGArg ret,
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -900,19 +901,19 @@ static void tcg_out_setcond2(TCGContext *s, int
cond, TCGArg ret,
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
static const void * const qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void * const qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index ce6cfe6..517bc49 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -962,6 +962,7 @@ static void tcg_out_jmp(TCGContext *s, tcg_target_long dest)
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -978,19 +979,19 @@ static void tcg_out_jmp(TCGContext *s,
tcg_target_long dest)
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
static const void *qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void *qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
diff --git a/tcg/ia64/tcg-target.c b/tcg/ia64/tcg-target.c
index 7484395..f95ae5e 100644
--- a/tcg/ia64/tcg-target.c
+++ b/tcg/ia64/tcg-target.c
@@ -1454,6 +1454,7 @@ static inline void tcg_out_qemu_tlb(TCGContext
*s, TCGArg addr_reg,
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -1470,10 +1471,10 @@ static inline void tcg_out_qemu_tlb(TCGContext
*s, TCGArg addr_reg,
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
static const void * const qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
@@ -1587,10 +1588,10 @@ static inline void tcg_out_qemu_ld(TCGContext
*s, const TCGArg *args, int opc)
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void * const qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __st_mmu(target_ulong addr, uintxx_t val,
diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
index af97e03..26e667f 100644
--- a/tcg/mips/tcg-target.c
+++ b/tcg/mips/tcg-target.c
@@ -752,6 +752,7 @@ static void tcg_out_setcond2(TCGContext *s,
TCGCond cond, int ret,
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -768,19 +769,19 @@ static void tcg_out_setcond2(TCGContext *s,
TCGCond cond, int ret,
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
static const void * const qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void * const qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
index 32347f2..6ed052b 100644
--- a/tcg/ppc/tcg-target.c
+++ b/tcg/ppc/tcg-target.c
@@ -510,6 +510,7 @@ static void tcg_out_call (TCGContext *s,
tcg_target_long arg, int const_arg)
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -526,19 +527,19 @@ static void tcg_out_call (TCGContext *s,
tcg_target_long arg, int const_arg)
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
static const void * const qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void * const qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
index 3610d88..7e0e209 100644
--- a/tcg/ppc64/tcg-target.c
+++ b/tcg/ppc64/tcg-target.c
@@ -554,6 +554,7 @@ static void tcg_out_ldsta (TCGContext *s, int ret, int addr,
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -570,19 +571,19 @@ static void tcg_out_ldsta (TCGContext *s, int
ret, int addr,
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
static const void * const qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void * const qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index 90dd6fa..5d60985 100644
--- a/tcg/s390/tcg-target.c
+++ b/tcg/s390/tcg-target.c
@@ -303,6 +303,7 @@ static const uint8_t tcg_cond_to_ltr_cond[10] = {
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -319,19 +320,19 @@ static const uint8_t tcg_cond_to_ltr_cond[10] = {
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
static const void * const qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void * const qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
index 1227a15..319b89e 100644
--- a/tcg/sparc/tcg-target.c
+++ b/tcg/sparc/tcg-target.c
@@ -717,6 +717,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
#ifdef CONFIG_TCG_PASS_AREG0
#define MMUSUFFIX _mmu
+#define GEN_TCG_HELPER
#define SHIFT 0
#include "softmmu_template.h"
@@ -733,19 +734,19 @@ static void tcg_target_qemu_prologue(TCGContext *s)
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
int mmu_idx) */
static const void * const qemu_ld_helpers[4] = {
- helper_ldb_mmu,
- helper_ldw_mmu,
- helper_ldl_mmu,
- helper_ldq_mmu,
+ tcg_helper_qemu_ldb,
+ tcg_helper_qemu_ldw,
+ tcg_helper_qemu_ldl,
+ tcg_helper_qemu_ldq,
};
/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
uintxx_t val, int mmu_idx) */
static const void * const qemu_st_helpers[4] = {
- helper_stb_mmu,
- helper_stw_mmu,
- helper_stl_mmu,
- helper_stq_mmu,
+ tcg_helper_qemu_stb,
+ tcg_helper_qemu_stw,
+ tcg_helper_qemu_stl,
+ tcg_helper_qemu_stq,
};
#else
/* legacy helper signature: __ld_mmu(target_ulong addr, int
--
1.7.10
0004-softmmu-add-a-faster-helper-for-TCG.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 4/4] softmmu: add a faster helper for TCG,
Blue Swirl <=