From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
patches@linaro.org
Subject: [Qemu-devel] [PATCH 2/2] cpu_ldst.h: Collapse laddr() and saddr() into ldst_get_host_addr()
Date: Tue, 13 Jan 2015 18:32:01 +0000 [thread overview]
Message-ID: <1421173921-28848-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1421173921-28848-1-git-send-email-peter.maydell@linaro.org>
The macros laddr() and saddr() are always defined to be identical
to each other. Replace them with a single macro, and give it a
longer name so it's easier to grep the codebase and confirm that
it's only used in this one place: ldst_get_host_addr().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/exec/cpu_ldst.h | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 4700831..0aae9e4 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -53,30 +53,31 @@
h2g_nocheck(x); \
})
-#define saddr(x) g2h(x)
-#define laddr(x) g2h(x)
+#define ldst_get_host_addr(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)
+#define ldst_get_host_addr(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)
+/* Note that ldst_get_host_addr() should not be used anywhere outside
+ * these macros
+ */
+#define ldub_raw(p) ldub_p(ldst_get_host_addr(p))
+#define ldsb_raw(p) ldsb_p(ldst_get_host_addr(p))
+#define lduw_raw(p) lduw_p(ldst_get_host_addr(p))
+#define ldsw_raw(p) ldsw_p(ldst_get_host_addr(p))
+#define ldl_raw(p) ldl_p(ldst_get_host_addr(p))
+#define ldq_raw(p) ldq_p(ldst_get_host_addr(p))
+#define ldfl_raw(p) ldfl_p(ldst_get_host_addr(p))
+#define ldfq_raw(p) ldfq_p(ldst_get_host_addr(p))
+#define stb_raw(p, v) stb_p(ldst_get_host_addr(p), v)
+#define stw_raw(p, v) stw_p(ldst_get_host_addr(p), v)
+#define stl_raw(p, v) stl_p(ldst_get_host_addr(p), v)
+#define stq_raw(p, v) stq_p(ldst_get_host_addr(p), v)
+#define stfl_raw(p, v) stfl_p(ldst_get_host_addr(p), v)
+#define stfq_raw(p, v) stfq_p(ldst_get_host_addr(p), v)
#if defined(CONFIG_USER_ONLY)
--
1.9.1
next prev parent reply other threads:[~2015-01-13 18:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 18:31 [Qemu-devel] [PATCH 0/2] cpu_ldst.h: Minor cleanups in ld/st macros Peter Maydell
2015-01-13 18:32 ` [Qemu-devel] [PATCH 1/2] cpu_ldst.h: Remove unused ldul_ macros Peter Maydell
2015-01-13 19:50 ` Paolo Bonzini
2015-01-13 18:32 ` Peter Maydell [this message]
2015-01-13 19:15 ` [Qemu-devel] [PATCH 2/2] cpu_ldst.h: Collapse laddr() and saddr() into ldst_get_host_addr() Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421173921-28848-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).