qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC][PATCH v2 2/4] tcg: add extended MMU helpers to so


From: Peter Maydell
Subject: Re: [Qemu-devel] [RFC][PATCH v2 2/4] tcg: add extended MMU helpers to softmmu targets
Date: Thu, 5 Jul 2012 14:43:59 +0100

On 5 July 2012 14:23, Yeongkyoon Lee <address@hidden> wrote:
> Add extended MMU helpers to softmmu targets, where the targets are alpha, 
> arm, cris, i386, lm32, m68k, microblaze, mips, ppc, s390x, sh4, sparc and 
> xtensa.
>
> Signed-off-by: Yeongkyoon Lee <address@hidden>
> ---
>  target-alpha/mem_helper.c     |   22 ++++++++++++++++++++++
>  target-arm/op_helper.c        |   23 +++++++++++++++++++++++
>  target-cris/op_helper.c       |   22 ++++++++++++++++++++++
>  target-i386/mem_helper.c      |   22 ++++++++++++++++++++++
>  target-lm32/op_helper.c       |   23 ++++++++++++++++++++++-
>  target-m68k/op_helper.c       |   22 ++++++++++++++++++++++
>  target-microblaze/op_helper.c |   22 ++++++++++++++++++++++
>  target-mips/op_helper.c       |   22 ++++++++++++++++++++++
>  target-ppc/mem_helper.c       |   22 ++++++++++++++++++++++
>  target-s390x/op_helper.c      |   22 ++++++++++++++++++++++
>  target-sh4/op_helper.c        |   22 ++++++++++++++++++++++
>  target-sparc/ldst_helper.c    |   23 +++++++++++++++++++++++
>  target-xtensa/op_helper.c     |   22 ++++++++++++++++++++++
>  13 files changed, 288 insertions(+), 1 deletions(-)

This makes the already slightly repetitive inclusion of the
softmmu_templates even more repetitive. Perhaps we could abstract
it all out into a single header which the targets can include?

>
> diff --git a/target-alpha/mem_helper.c b/target-alpha/mem_helper.c
> index 87cada4..ef880a7 100644
> --- a/target-alpha/mem_helper.c
> +++ b/target-alpha/mem_helper.c
> @@ -132,6 +132,28 @@ void cpu_unassigned_access(CPUAlphaState *env, 
> target_phys_addr_t addr,
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization

"Extended".

> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  /* 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 490111c..8ff1209 100644
> --- a/target-arm/op_helper.c
> +++ b/target-arm/op_helper.c
> @@ -69,6 +69,29 @@ uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def,
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  /* 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 ac7c98c..cc34f3c 100644
> --- a/target-cris/op_helper.c
> +++ b/target-cris/op_helper.c
> @@ -52,6 +52,28 @@
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  /* 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 91353c0..59fb03c 100644
> --- a/target-i386/mem_helper.c
> +++ b/target-i386/mem_helper.c
> @@ -126,6 +126,28 @@ void helper_boundl(target_ulong a0, int v)
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  #endif
>
>  #if !defined(CONFIG_USER_ONLY)
> diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c
> index 51edc1a..bcdddf7 100644
> --- a/target-lm32/op_helper.c
> +++ b/target-lm32/op_helper.c
> @@ -18,6 +18,28 @@
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  void helper_raise_exception(uint32_t index)
>  {
>      env->exception_index = index;
> @@ -101,4 +123,3 @@ void tlb_fill(CPULM32State *env1, target_ulong addr, int 
> is_write, int mmu_idx,
>      env = saved_env;
>  }
>  #endif
> -
> diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c
> index 1971a57..454fd71 100644
> --- a/target-m68k/op_helper.c
> +++ b/target-m68k/op_helper.c
> @@ -51,6 +51,28 @@ extern int semihosting_enabled;
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  /* 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 3b1f072..12be3bd 100644
> --- a/target-microblaze/op_helper.c
> +++ b/target-microblaze/op_helper.c
> @@ -39,6 +39,28 @@
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  /* 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 66037ac..c2fd2db 100644
> --- a/target-mips/op_helper.c
> +++ b/target-mips/op_helper.c
> @@ -2303,6 +2303,28 @@ static void QEMU_NORETURN 
> do_unaligned_access(target_ulong addr, int is_write,
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  static void do_unaligned_access(target_ulong addr, int is_write,
>                                  int is_user, uintptr_t retaddr)
>  {
> diff --git a/target-ppc/mem_helper.c b/target-ppc/mem_helper.c
> index 5b5f1bd..01a9ac6 100644
> --- a/target-ppc/mem_helper.c
> +++ b/target-ppc/mem_helper.c
> @@ -268,6 +268,28 @@ STVE(stvewx, cpu_stl_data, bswap32, u32)
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  /* 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/op_helper.c b/target-s390x/op_helper.c
> index 7b72473..05109c5 100644
> --- a/target-s390x/op_helper.c
> +++ b/target-s390x/op_helper.c
> @@ -52,6 +52,28 @@
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  /* 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 4054791..f7c1f67 100644
> --- a/target-sh4/op_helper.c
> +++ b/target-sh4/op_helper.c
> @@ -53,6 +53,28 @@ static void cpu_restore_state_from_retaddr(uintptr_t 
> retaddr)
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  void tlb_fill(CPUSH4State *env1, 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 9bec7a9..1ceb588 100644
> --- a/target-sparc/ldst_helper.c
> +++ b/target-sparc/ldst_helper.c
> @@ -80,6 +80,29 @@
>
>  #define SHIFT 3
>  #include "softmmu_template.h"
> +
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  #endif
>
>  #if defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
> diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
> index 2659c0e..536e1fb 100644
> --- a/target-xtensa/op_helper.c
> +++ b/target-xtensa/op_helper.c
> @@ -47,6 +47,28 @@ static void do_unaligned_access(CPUXtensaState *env,
>  #define SHIFT 3
>  #include "softmmu_template.h"
>
> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
> +/* Exteneded MMU helper funtions for qemu_ld/st optimization
> +   Note that normal helper functions should be defined above
> +   to avoid duplication of common functions, slow_ld/st and io_read/write.
> + */
> +#define USE_EXTENDED_HELPER
> +
> +#define SHIFT 0
> +#include "softmmu_template.h"
> +
> +#define SHIFT 1
> +#include "softmmu_template.h"
> +
> +#define SHIFT 2
> +#include "softmmu_template.h"
> +
> +#define SHIFT 3
> +#include "softmmu_template.h"
> +
> +#undef USE_EXTENDED_HELPER
> +#endif  /* CONFIG_QEMU_LDST_OPTIMIZATION */
> +
>  static void do_restore_state(CPUXtensaState *env, uintptr_t pc)
>  {
>      TranslationBlock *tb;
> --
> 1.7.4.1
>

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]