softmmu: commonize helper definitions
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 28 Mar 2014 16:55:24 +0000 (17:55 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 5 Jun 2014 14:10:33 +0000 (16:10 +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 <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
18 files changed:
cputlb.c
include/exec/softmmu_template.h
target-alpha/mem_helper.c
target-arm/op_helper.c
target-cris/op_helper.c
target-i386/mem_helper.c
target-lm32/op_helper.c
target-m68k/op_helper.c
target-microblaze/op_helper.c
target-mips/op_helper.c
target-moxie/helper.c
target-openrisc/mmu_helper.c
target-ppc/mmu_helper.c
target-s390x/mem_helper.c
target-sh4/op_helper.c
target-sparc/ldst_helper.c
target-unicore32/op_helper.c
target-xtensa/op_helper.c

index 214c945edbd09da367af582c268fe6a41b5effe5..0a884f8003d857951a39219057e3e47d4c677519 100644 (file)
--- 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
index 12ead5a2b10673bf6894ef85efd24d7ed6870dbe..5a07f991a1453da4751f2f24a7d012e12fe232d5 100644 (file)
 # 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))
index c5c1165190a283246068148835b50ad8ec038e39..7860c05e483746c8b17721e0cfd941bb63703070 100644 (file)
@@ -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) */
index b28f694d0010e7c190f72f8046ca78046c9cea14..41fd6f6fd0560faf8f2e70d06ee9261187385dd4 100644 (file)
@@ -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)
index a9bd742d3b32e8d5dcba14fb701eeef16376fd2e..0ce5f09fa9a1044eaf4a8a40c44cdf4f6e0590be 100644 (file)
 #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) */
index 83aa1038d72e4590c989539a09b23e0be84565d7..16bc91bcb4651d77bbf42437b421e50ea884e2eb 100644 (file)
@@ -109,24 +109,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
index 40fbed64c347dccc3f18d3dc8c2161ef083599c2..c54de3e0e68826483ccd8b0285f3b0e96039e5ab 100644 (file)
 #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));
index f1ac139c51041524a8baf7c8996d770616887037..e11990c539686337ef93a02955544c43efb43a2e 100644 (file)
@@ -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) */
index b24b878919faaa22a369792c6fb58906cd14666c..72c1bdf61d6e060e9652d8862e656e98d0eae57e 100644 (file)
 #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)
index 1c79b686882ba13c92343b910e6fec3e357abb66..f1ec18b0b39cf2fe37e6ac4387f58681c794e3e0 100644 (file)
@@ -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)
 {
index d1efdedf9dda71a8cdfb5a00383567bffdf3dfd3..481a33039cc0a5009839541d6fa83ae577244be1 100644 (file)
 #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) */
index fb457c76af00d55290aeb97a113bc4d0b4cee930..526363435b45084ec916dc804fd5421affa80112 100644 (file)
 
 #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)
index a238bb2731eb3d4f54503337b0d5237c37864dd2..1875636621ace447addd5a496cc9382ef6f6a775 100644 (file)
@@ -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) */
index 5a29841d71c2061863692424a4c4a3856ce1a90a..3a0376ead30206a1dd5be224b965cefd8033d597 100644 (file)
 #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) */
index 39e1e7cbef4d2a1e48bc5c4c7265cdbcf2aa518f..ddd4186c7bf71ee9ff3ef40339664e05e2a479fc 100644 (file)
 #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)
 {
index 5dec92496884c64997aed955af8e784af2805e95..0843c77244e92b6edf061f5bd780f77fc3ab5d09 100644 (file)
 
 #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)
index 4f96ed350b397fd5cdbdb1d66fe1cd1b21d6ff0f..a369ac6464a75ef5c10b0188d5f0ee97b259aca4 100644 (file)
@@ -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)
 {
index 9ce81e2084871fabb5ea714db74d7b083b00c5d2..a772295109e9b485a63dd9633f65df4db05bd8b1 100644 (file)
 #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)