From 0c021c1fd2c4ec3c68c59232ccee012c067bc682 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 20 Jan 2015 15:19:32 +0000 Subject: cpu_ldst.h: Remove unused ldul_ macros The five ldul_ macros are not used anywhere and are marked up with an XXX comment. "ldul" is a non-standard prefix for our family of load instructions: we don't mark 32-bit accesses for signedness because they return a 32 bit quantity. So just delete them. Signed-off-by: Peter Maydell Reviewed-by: Paolo Bonzini Reviewed-by: Richard Henderson Message-id: 1421334118-3287-2-git-send-email-peter.maydell@linaro.org --- include/exec/cpu_ldst.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include/exec/cpu_ldst.h') diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index e5550e7..4700831 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -151,15 +151,6 @@ #else -/* XXX: find something cleaner. - * Furthermore, this is false for 64 bits targets - */ -#define ldul_user ldl_user -#define ldul_kernel ldl_kernel -#define ldul_hypv ldl_hypv -#define ldul_executive ldl_executive -#define ldul_supervisor ldl_supervisor - /* The memory helpers for tcg-generated code need tcg_target_long etc. */ #include "tcg.h" -- cgit v1.1 From 5a0826f7d2f9bea6e02157985b103d0a4c458aaa Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 20 Jan 2015 15:19:34 +0000 Subject: cpu_ldst.h: Drop unused ld/st*_kernel defines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ld*_kernel and st*_kernel defines are not used anywhere; delete them. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Paolo Bonzini Reviewed-by: Alex Bennée Message-id: 1421334118-3287-10-git-send-email-peter.maydell@linaro.org --- include/exec/cpu_ldst.h | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'include/exec/cpu_ldst.h') diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 4700831..64d9087 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -126,21 +126,6 @@ #define cpu_stl_kernel(env, addr, data) stl_raw(addr, data) #define cpu_stq_kernel(env, addr, data) stq_raw(addr, data) -#define ldub_kernel(p) ldub_raw(p) -#define ldsb_kernel(p) ldsb_raw(p) -#define lduw_kernel(p) lduw_raw(p) -#define ldsw_kernel(p) ldsw_raw(p) -#define ldl_kernel(p) ldl_raw(p) -#define ldq_kernel(p) ldq_raw(p) -#define ldfl_kernel(p) ldfl_raw(p) -#define ldfq_kernel(p) ldfq_raw(p) -#define stb_kernel(p, v) stb_raw(p, v) -#define stw_kernel(p, v) stw_raw(p, v) -#define stl_kernel(p, v) stl_raw(p, v) -#define stq_kernel(p, v) stq_raw(p, v) -#define stfl_kernel(p, v) stfl_raw(p, v) -#define stfq_kernel(p, vt) stfq_raw(p, v) - #define cpu_ldub_data(env, addr) ldub_raw(addr) #define cpu_lduw_data(env, addr) lduw_raw(addr) #define cpu_ldl_data(env, addr) ldl_raw(addr) -- cgit v1.1 From 177ea79f65c90b3bc84d59565b7519e47ea02f63 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 20 Jan 2015 15:19:34 +0000 Subject: cpu_ldst.h: Remove unused very short ld*/st* defines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The very short ld*/st* defines are now not used anywhere; delete them. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Paolo Bonzini Reviewed-by: Alex Bennée Message-id: 1421334118-3287-11-git-send-email-peter.maydell@linaro.org --- include/exec/cpu_ldst.h | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'include/exec/cpu_ldst.h') diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 64d9087..2dc4775 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -82,20 +82,6 @@ #if defined(CONFIG_USER_ONLY) /* if user mode, no other memory access functions */ -#define ldub(p) ldub_raw(p) -#define ldsb(p) ldsb_raw(p) -#define lduw(p) lduw_raw(p) -#define ldsw(p) ldsw_raw(p) -#define ldl(p) ldl_raw(p) -#define ldq(p) ldq_raw(p) -#define ldfl(p) ldfl_raw(p) -#define ldfq(p) ldfq_raw(p) -#define stb(p, v) stb_raw(p, v) -#define stw(p, v) stw_raw(p, v) -#define stl(p, v) stl_raw(p, v) -#define stq(p, v) stq_raw(p, v) -#define stfl(p, v) stfl_raw(p, v) -#define stfq(p, v) stfq_raw(p, v) #define cpu_ldub_code(env1, p) ldub_raw(p) #define cpu_ldsb_code(env1, p) ldsb_raw(p) @@ -287,18 +273,6 @@ uint64_t helper_ldq_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); #undef CPU_MMU_INDEX #undef MEMSUFFIX -#define ldub(p) ldub_data(p) -#define ldsb(p) ldsb_data(p) -#define lduw(p) lduw_data(p) -#define ldsw(p) ldsw_data(p) -#define ldl(p) ldl_data(p) -#define ldq(p) ldq_data(p) - -#define stb(p, v) stb_data(p, v) -#define stw(p, v) stw_data(p, v) -#define stl(p, v) stl_data(p, v) -#define stq(p, v) stq_data(p, v) - #define CPU_MMU_INDEX (cpu_mmu_index(env)) #define MEMSUFFIX _code #define SOFTMMU_CODE_ACCESS -- cgit v1.1 From 9220fe54c679d145232a28df6255e166ebf91bab Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 20 Jan 2015 15:19:34 +0000 Subject: cpu_ldst.h: Use inline functions for usermode cpu_ld/st accessors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use inline functions rather than macros for cpu_ld/st accessors for the *-user configurations, as we already do for softmmu. This has a two advantages: * we can actually typecheck our arguments * we don't need to leak the _raw macros everywhere Since the _kernel functions were only used by target-i386/seg_helper.c, put the definitions for them in that file too. (It already has the similar template include code to define them for the softmmu case, so it makes sense to have it deal with defining them for user-only.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Paolo Bonzini Reviewed-by: Alex Bennée Message-id: 1421334118-3287-12-git-send-email-peter.maydell@linaro.org --- include/exec/cpu_ldst.h | 70 ++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 39 deletions(-) (limited to 'include/exec/cpu_ldst.h') diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 2dc4775..bef2e5f 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -78,47 +78,39 @@ #define stfl_raw(p, v) stfl_p(saddr((p)), v) #define stfq_raw(p, v) stfq_p(saddr((p)), v) - #if defined(CONFIG_USER_ONLY) -/* if user mode, no other memory access functions */ - -#define cpu_ldub_code(env1, p) ldub_raw(p) -#define cpu_ldsb_code(env1, p) ldsb_raw(p) -#define cpu_lduw_code(env1, p) lduw_raw(p) -#define cpu_ldsw_code(env1, p) ldsw_raw(p) -#define cpu_ldl_code(env1, p) ldl_raw(p) -#define cpu_ldq_code(env1, p) ldq_raw(p) - -#define cpu_ldub_data(env, addr) ldub_raw(addr) -#define cpu_lduw_data(env, addr) lduw_raw(addr) -#define cpu_ldsw_data(env, addr) ldsw_raw(addr) -#define cpu_ldl_data(env, addr) ldl_raw(addr) -#define cpu_ldq_data(env, addr) ldq_raw(addr) - -#define cpu_stb_data(env, addr, data) stb_raw(addr, data) -#define cpu_stw_data(env, addr, data) stw_raw(addr, data) -#define cpu_stl_data(env, addr, data) stl_raw(addr, data) -#define cpu_stq_data(env, addr, data) stq_raw(addr, data) - -#define cpu_ldub_kernel(env, addr) ldub_raw(addr) -#define cpu_lduw_kernel(env, addr) lduw_raw(addr) -#define cpu_ldsw_kernel(env, addr) ldsw_raw(addr) -#define cpu_ldl_kernel(env, addr) ldl_raw(addr) -#define cpu_ldq_kernel(env, addr) ldq_raw(addr) - -#define cpu_stb_kernel(env, addr, data) stb_raw(addr, data) -#define cpu_stw_kernel(env, addr, data) stw_raw(addr, data) -#define cpu_stl_kernel(env, addr, data) stl_raw(addr, data) -#define cpu_stq_kernel(env, addr, data) stq_raw(addr, data) - -#define cpu_ldub_data(env, addr) ldub_raw(addr) -#define cpu_lduw_data(env, addr) lduw_raw(addr) -#define cpu_ldl_data(env, addr) ldl_raw(addr) - -#define cpu_stb_data(env, addr, data) stb_raw(addr, data) -#define cpu_stw_data(env, addr, data) stw_raw(addr, data) -#define cpu_stl_data(env, addr, data) stl_raw(addr, data) +/* In user-only mode we provide only the _code and _data accessors. */ + +#define MEMSUFFIX _data +#define DATA_SIZE 1 +#include "exec/cpu_ldst_useronly_template.h" + +#define DATA_SIZE 2 +#include "exec/cpu_ldst_useronly_template.h" + +#define DATA_SIZE 4 +#include "exec/cpu_ldst_useronly_template.h" + +#define DATA_SIZE 8 +#include "exec/cpu_ldst_useronly_template.h" +#undef MEMSUFFIX + +#define MEMSUFFIX _code +#define CODE_ACCESS +#define DATA_SIZE 1 +#include "exec/cpu_ldst_useronly_template.h" + +#define DATA_SIZE 2 +#include "exec/cpu_ldst_useronly_template.h" + +#define DATA_SIZE 4 +#include "exec/cpu_ldst_useronly_template.h" + +#define DATA_SIZE 8 +#include "exec/cpu_ldst_useronly_template.h" +#undef MEMSUFFIX +#undef CODE_ACCESS #else -- cgit v1.1 From 800e2ecc896beb6b79e7333c762da163b6a9135a Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 20 Jan 2015 15:19:34 +0000 Subject: cpu_ldst.h: Drop unused _raw macros, saddr() and laddr() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The _raw macros and their helpers saddr() and laddr() are now totally unused -- delete them. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Paolo Bonzini Reviewed-by: Alex Bennée Message-id: 1421334118-3287-14-git-send-email-peter.maydell@linaro.org --- include/exec/cpu_ldst.h | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'include/exec/cpu_ldst.h') diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index bef2e5f..16f4e30 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -53,31 +53,8 @@ h2g_nocheck(x); \ }) -#define saddr(x) g2h(x) -#define laddr(x) g2h(x) - -#else /* !CONFIG_USER_ONLY */ -/* NOTE: we use double casts if pointers and target_ulong have - different sizes */ -#define saddr(x) (uint8_t *)(intptr_t)(x) -#define laddr(x) (uint8_t *)(intptr_t)(x) #endif -#define ldub_raw(p) ldub_p(laddr((p))) -#define ldsb_raw(p) ldsb_p(laddr((p))) -#define lduw_raw(p) lduw_p(laddr((p))) -#define ldsw_raw(p) ldsw_p(laddr((p))) -#define ldl_raw(p) ldl_p(laddr((p))) -#define ldq_raw(p) ldq_p(laddr((p))) -#define ldfl_raw(p) ldfl_p(laddr((p))) -#define ldfq_raw(p) ldfq_p(laddr((p))) -#define stb_raw(p, v) stb_p(saddr((p)), v) -#define stw_raw(p, v) stw_p(saddr((p)), v) -#define stl_raw(p, v) stl_p(saddr((p)), v) -#define stq_raw(p, v) stq_p(saddr((p)), v) -#define stfl_raw(p, v) stfl_p(saddr((p)), v) -#define stfq_raw(p, v) stfq_p(saddr((p)), v) - #if defined(CONFIG_USER_ONLY) /* In user-only mode we provide only the _code and _data accessors. */ -- cgit v1.1 From db5fd8d709fd57f4d4f11edfca9f421f657f4508 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 20 Jan 2015 15:19:35 +0000 Subject: cpu_ldst.h, cpu-all.h, bswap.h: Update documentation on ld/st accessors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add documentation of what the cpu_*_* accessors look like. Correct some minor errors in the existing documentation of the direct _p accessor family. Remove the near-duplicate comment on the _p accessors from cpu-all.h and replace it with a reference to the comment in bswap.h. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Paolo Bonzini Reviewed-by: Alex Bennée Message-id: 1421334118-3287-16-git-send-email-peter.maydell@linaro.org --- include/exec/cpu_ldst.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'include/exec/cpu_ldst.h') diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 16f4e30..d98ff17 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -23,7 +23,26 @@ * * Used by target op helpers. * - * MMU mode suffixes are defined in target cpu.h. + * The syntax for the accessors is: + * + * load: cpu_ld{sign}{size}_{mmusuffix}(env, ptr) + * + * store: cpu_st{sign}{size}_{mmusuffix}(env, ptr, val) + * + * sign is: + * (empty): for 32 and 64 bit sizes + * u : unsigned + * s : signed + * + * size is: + * b: 8 bits + * w: 16 bits + * l: 32 bits + * q: 64 bits + * + * mmusuffix is one of the generic suffixes "data" or "code", or + * (for softmmu configs) a target-specific MMU mode suffix as defined + * in target cpu.h. */ #ifndef CPU_LDST_H #define CPU_LDST_H -- cgit v1.1 From de5ee4a888667ca0a198f0743d70075d70564117 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 20 Jan 2015 15:19:35 +0000 Subject: cpu_ldst.h: Don't define helpers if MMU_MODE*_SUFFIX not defined Not all targets define a full set of suffix strings for the NB_MMU_MODES that they have. In this situation, don't define any helper functions for that mode, rather than defining helper functions with no suffix at all. The MMU mode is still functional; it is merely not directly accessible via cpu_ld*_MODE from target helper functions. Also add an "NB_MMU_MODES >= 2" check to the definition of the mode 1 helpers -- some targets only define one MMU mode. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 1421432008-6786-1-git-send-email-peter.maydell@linaro.org --- include/exec/cpu_ldst.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'include/exec/cpu_ldst.h') diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index d98ff17..0e825ea 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -132,6 +132,7 @@ uint16_t helper_ldw_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); uint32_t helper_ldl_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); uint64_t helper_ldq_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); +#ifdef MMU_MODE0_SUFFIX #define CPU_MMU_INDEX 0 #define MEMSUFFIX MMU_MODE0_SUFFIX #define DATA_SIZE 1 @@ -147,7 +148,9 @@ uint64_t helper_ldq_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); #include "exec/cpu_ldst_template.h" #undef CPU_MMU_INDEX #undef MEMSUFFIX +#endif +#if (NB_MMU_MODES >= 2) && defined(MMU_MODE1_SUFFIX) #define CPU_MMU_INDEX 1 #define MEMSUFFIX MMU_MODE1_SUFFIX #define DATA_SIZE 1 @@ -163,8 +166,9 @@ uint64_t helper_ldq_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); #include "exec/cpu_ldst_template.h" #undef CPU_MMU_INDEX #undef MEMSUFFIX +#endif -#if (NB_MMU_MODES >= 3) +#if (NB_MMU_MODES >= 3) && defined(MMU_MODE2_SUFFIX) #define CPU_MMU_INDEX 2 #define MEMSUFFIX MMU_MODE2_SUFFIX @@ -183,7 +187,7 @@ uint64_t helper_ldq_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); #undef MEMSUFFIX #endif /* (NB_MMU_MODES >= 3) */ -#if (NB_MMU_MODES >= 4) +#if (NB_MMU_MODES >= 4) && defined(MMU_MODE3_SUFFIX) #define CPU_MMU_INDEX 3 #define MEMSUFFIX MMU_MODE3_SUFFIX @@ -202,7 +206,7 @@ uint64_t helper_ldq_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); #undef MEMSUFFIX #endif /* (NB_MMU_MODES >= 4) */ -#if (NB_MMU_MODES >= 5) +#if (NB_MMU_MODES >= 5) && defined(MMU_MODE4_SUFFIX) #define CPU_MMU_INDEX 4 #define MEMSUFFIX MMU_MODE4_SUFFIX @@ -221,7 +225,7 @@ uint64_t helper_ldq_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx); #undef MEMSUFFIX #endif /* (NB_MMU_MODES >= 5) */ -#if (NB_MMU_MODES >= 6) +#if (NB_MMU_MODES >= 6) && defined(MMU_MODE5_SUFFIX) #define CPU_MMU_INDEX 5 #define MEMSUFFIX MMU_MODE5_SUFFIX -- cgit v1.1