[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/33] softmmu: commonize helper definitions
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 09/33] softmmu: commonize helper definitions |
Date: |
Thu, 5 Jun 2014 16:21:59 +0200 |
They do not need to be in op_helper.c. Because cputlb.c now includes
softmmu_template.h twice for each size, io_readX must be elided the
second time through.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cputlb.c | 18 ++++++++++++++++--
include/exec/softmmu_template.h | 2 ++
target-alpha/mem_helper.c | 14 --------------
target-arm/op_helper.c | 14 --------------
target-cris/op_helper.c | 14 --------------
target-i386/mem_helper.c | 18 ------------------
target-lm32/op_helper.c | 10 ----------
target-m68k/op_helper.c | 14 --------------
target-microblaze/op_helper.c | 10 ----------
target-mips/op_helper.c | 14 --------------
target-moxie/helper.c | 14 --------------
target-openrisc/mmu_helper.c | 13 -------------
target-ppc/mmu_helper.c | 14 --------------
target-s390x/mem_helper.c | 14 --------------
target-sh4/op_helper.c | 14 --------------
target-sparc/ldst_helper.c | 13 -------------
target-unicore32/op_helper.c | 14 --------------
target-xtensa/op_helper.c | 15 +--------------
18 files changed, 19 insertions(+), 220 deletions(-)
diff --git a/cputlb.c b/cputlb.c
index 214c945..0a884f8 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -27,6 +27,7 @@
#include "exec/memory-internal.h"
#include "exec/ram_addr.h"
+#include "tcg/tcg.h"
//#define DEBUG_TLB
//#define DEBUG_TLB_CHECK
@@ -330,6 +331,21 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1,
target_ulong addr)
return qemu_ram_addr_from_host_nofail(p);
}
+#define MMUSUFFIX _mmu
+
+#define SHIFT 0
+#include "exec/softmmu_template.h"
+
+#define SHIFT 1
+#include "exec/softmmu_template.h"
+
+#define SHIFT 2
+#include "exec/softmmu_template.h"
+
+#define SHIFT 3
+#include "exec/softmmu_template.h"
+#undef MMUSUFFIX
+
#define MMUSUFFIX _cmmu
#undef GETPC_ADJ
#define GETPC_ADJ 0
@@ -348,5 +364,3 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1,
target_ulong addr)
#define SHIFT 3
#include "exec/softmmu_template.h"
-
-#undef env
diff --git a/include/exec/softmmu_template.h b/include/exec/softmmu_template.h
index 12ead5a..5a07f99 100644
--- a/include/exec/softmmu_template.h
+++ b/include/exec/softmmu_template.h
@@ -116,6 +116,7 @@
# define helper_te_st_name helper_le_st_name
#endif
+#ifndef SOFTMMU_CODE_ACCESS
static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env,
hwaddr physaddr,
target_ulong addr,
@@ -135,6 +136,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState
*env,
io_mem_read(mr, physaddr, &val, 1 << SHIFT);
return val;
}
+#endif
#ifdef SOFTMMU_CODE_ACCESS
static __attribute__((unused))
diff --git a/target-alpha/mem_helper.c b/target-alpha/mem_helper.c
index c5c1165..7860c05 100644
--- a/target-alpha/mem_helper.c
+++ b/target-alpha/mem_helper.c
@@ -133,20 +133,6 @@ void alpha_cpu_unassigned_access(CPUState *cs, hwaddr addr,
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
/* try to fill the TLB and return an exception if error. If retaddr is
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index b28f694..41fd6f6 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -58,20 +58,6 @@ uint32_t HELPER(neon_tbl)(CPUARMState *env, uint32_t ireg,
uint32_t def,
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
/* try to fill the TLB and return an exception if error. If retaddr is
* NULL, it means that the function was called in C code (i.e. not
* from generated code or from helper.c)
diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c
index a9bd742..0ce5f09 100644
--- a/target-cris/op_helper.c
+++ b/target-cris/op_helper.c
@@ -37,20 +37,6 @@
#if !defined(CONFIG_USER_ONLY)
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
/* Try to fill the TLB and return an exception if error. If retaddr is
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
diff --git a/target-i386/mem_helper.c b/target-i386/mem_helper.c
index 83aa103..16bc91b 100644
--- a/target-i386/mem_helper.c
+++ b/target-i386/mem_helper.c
@@ -110,24 +110,6 @@ void helper_boundl(CPUX86State *env, target_ulong a0, int
v)
}
#if !defined(CONFIG_USER_ONLY)
-
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
-#endif
-
-#if !defined(CONFIG_USER_ONLY)
/* try to fill the TLB and return an exception if error. If retaddr is
* NULL, it means that the function was called in C code (i.e. not
* from generated code or from helper.c)
diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c
index 40fbed6..c54de3e 100644
--- a/target-lm32/op_helper.c
+++ b/target-lm32/op_helper.c
@@ -13,16 +13,6 @@
#endif
#if !defined(CONFIG_USER_ONLY)
-#define MMUSUFFIX _mmu
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
void raise_exception(CPULM32State *env, int index)
{
CPUState *cs = CPU(lm32_env_get_cpu(env));
diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c
index f1ac139..e11990c 100644
--- a/target-m68k/op_helper.c
+++ b/target-m68k/op_helper.c
@@ -36,20 +36,6 @@ extern int semihosting_enabled;
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
/* Try to fill the TLB and return an exception if error. If retaddr is
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
index b24b878..72c1bdf 100644
--- a/target-microblaze/op_helper.c
+++ b/target-microblaze/op_helper.c
@@ -28,16 +28,6 @@
#if !defined(CONFIG_USER_ONLY)
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
/* Try to fill the TLB and return an exception if error. If retaddr is
* NULL, it means that the function was called in C code (i.e. not
* from generated code or from helper.c)
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 1c79b68..f1ec18b 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -2128,20 +2128,6 @@ void helper_wait(CPUMIPSState *env)
#if !defined(CONFIG_USER_ONLY)
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
void mips_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
int is_write, int is_user, uintptr_t retaddr)
{
diff --git a/target-moxie/helper.c b/target-moxie/helper.c
index d1efded..481a330 100644
--- a/target-moxie/helper.c
+++ b/target-moxie/helper.c
@@ -29,20 +29,6 @@
#include "qemu/host-utils.h"
#include "exec/helper-proto.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
/* Try to fill the TLB and return an exception if error. If retaddr is
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
diff --git a/target-openrisc/mmu_helper.c b/target-openrisc/mmu_helper.c
index fb457c7..5263634 100644
--- a/target-openrisc/mmu_helper.c
+++ b/target-openrisc/mmu_helper.c
@@ -22,19 +22,6 @@
#ifndef CONFIG_USER_ONLY
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
void tlb_fill(CPUState *cs, target_ulong addr, int is_write,
int mmu_idx, uintptr_t retaddr)
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index a238bb2..1875636 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -2905,20 +2905,6 @@ void helper_booke206_tlbflush(CPUPPCState *env, uint32_t
type)
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
/* try to fill the TLB and return an exception if error. If retaddr is
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c
index 5a29841..3a0376e 100644
--- a/target-s390x/mem_helper.c
+++ b/target-s390x/mem_helper.c
@@ -26,20 +26,6 @@
#if !defined(CONFIG_USER_ONLY)
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
/* try to fill the TLB and return an exception if error. If retaddr is
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c
index 39e1e7c..ddd4186 100644
--- a/target-sh4/op_helper.c
+++ b/target-sh4/op_helper.c
@@ -24,20 +24,6 @@
#ifndef CONFIG_USER_ONLY
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
uintptr_t retaddr)
{
diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c
index 5dec924..0843c77 100644
--- a/target-sparc/ldst_helper.c
+++ b/target-sparc/ldst_helper.c
@@ -66,19 +66,6 @@
#if !defined(CONFIG_USER_ONLY)
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
#endif
#if defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
diff --git a/target-unicore32/op_helper.c b/target-unicore32/op_helper.c
index 4f96ed3..a369ac6 100644
--- a/target-unicore32/op_helper.c
+++ b/target-unicore32/op_helper.c
@@ -243,20 +243,6 @@ uint32_t HELPER(ror_cc)(CPUUniCore32State *env, uint32_t
x, uint32_t i)
#ifndef CONFIG_USER_ONLY
#include "exec/softmmu_exec.h"
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
-
void tlb_fill(CPUState *cs, target_ulong addr, int is_write,
int mmu_idx, uintptr_t retaddr)
{
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
index 9ce81e2..a772295 100644
--- a/target-xtensa/op_helper.c
+++ b/target-xtensa/op_helper.c
@@ -30,20 +30,7 @@
#include "qemu/host-utils.h"
#include "exec/softmmu_exec.h"
#include "exec/address-spaces.h"
-
-#define MMUSUFFIX _mmu
-
-#define SHIFT 0
-#include "exec/softmmu_template.h"
-
-#define SHIFT 1
-#include "exec/softmmu_template.h"
-
-#define SHIFT 2
-#include "exec/softmmu_template.h"
-
-#define SHIFT 3
-#include "exec/softmmu_template.h"
+#include "qemu/timer.h"
void xtensa_cpu_do_unaligned_access(CPUState *cs,
vaddr addr, int is_write, int is_user, uintptr_t retaddr)
--
1.8.3.1
- [Qemu-devel] [PULL 00/33] softmmu cleanups and target-i386 paging fixes, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 01/33] cputlb: Fix regression with TCG interpreter (bug 1310324), Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 02/33] nseries: clean up coding style, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 03/33] hw: use ld_p/st_p instead of ld_raw/st_raw, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 04/33] softmmu: start introducing SOFTMMU_CODE_ACCESS in softmmu_header.h, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 06/33] softmmu: move definition of CPU_MMU_INDEX to inclusion site, drop ACCESS_TYPE, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 07/33] softmmu: make do_unaligned_access a method of CPU, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 08/33] softmmu: move ALIGNED_ONLY to cpu.h, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 05/33] softmmu: move MMUSUFFIX under SOFTMMU_CODE_ACCESS, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 09/33] softmmu: commonize helper definitions,
Paolo Bonzini <=
- [Qemu-devel] [PULL 12/33] softmmu: introduce cpu_ldst.h, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 10/33] softmmu: move softmmu_template.h out of include/, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 11/33] target-arm: move arm_*_code to a separate file, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 13/33] softmmu: move all load/store functions to cpu_ldst.h, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 16/33] target-i386: fix kernel accesses with SMAP and CPL = 3, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 15/33] target-i386: move check_io helpers to seg_helper.c, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 17/33] target-i386: simplify SMAP handling in MMU_KSMAP_IDX, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 14/33] target-i386: rename KSMAP to KNOSMAP, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 18/33] target-i386: fix coding standards in x86_cpu_handle_mmu_fault, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 20/33] target-i386: commonize checks for 4MB and 4KB pages, Paolo Bonzini, 2014/06/05