From: Tom Musta <tommusta@gmail.com>
To: qemu-devel@nongnu.org
Cc: Tom Musta <tommusta@gmail.com>, qemu-ppc@nongnu.org
Subject: [Qemu-devel] [V3 PATCH 06/14] target-ppc: Add ISA2.06 lbarx, lharx Instructions
Date: Wed, 18 Dec 2013 14:48:59 -0600 [thread overview]
Message-ID: <1387399747-4994-7-git-send-email-tommusta@gmail.com> (raw)
In-Reply-To: <1387399747-4994-1-git-send-email-tommusta@gmail.com>
This patch adds the byte and halfword variations of the Load and
Reserve instructions. Since there is much commonality among
all forms of Load and Reserve, a common macro is provided and the
existing implementations of lwarx and ldarx are re-implemented using
this macro.
V2: Fixed bug in aligment check for lharx (caught by Richard).
Signed-off-by: Tom Musta <tommusta@gmail.com>
---
target-ppc/translate.c | 50 +++++++++++++++++++++++------------------------
1 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 3344fa9..c3d0ebe 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -3218,21 +3218,29 @@ static void gen_isync(DisasContext *ctx)
gen_stop_exception(ctx);
}
-/* lwarx */
-static void gen_lwarx(DisasContext *ctx)
-{
- TCGv t0;
- TCGv gpr = cpu_gpr[rD(ctx->opcode)];
- gen_set_access_type(ctx, ACCESS_RES);
- t0 = tcg_temp_local_new();
- gen_addr_reg_index(ctx, t0);
- gen_check_align(ctx, t0, 0x03);
- gen_qemu_ld32u(ctx, gpr, t0);
- tcg_gen_mov_tl(cpu_reserve, t0);
- tcg_gen_st_tl(gpr, cpu_env, offsetof(CPUPPCState, reserve_val));
- tcg_temp_free(t0);
+#define LARX(name, len, loadop) \
+static void gen_##name(DisasContext *ctx) \
+{ \
+ TCGv t0; \
+ TCGv gpr = cpu_gpr[rD(ctx->opcode)]; \
+ gen_set_access_type(ctx, ACCESS_RES); \
+ t0 = tcg_temp_local_new(); \
+ gen_addr_reg_index(ctx, t0); \
+ if ((len) > 1) { \
+ gen_check_align(ctx, t0, (len)-1); \
+ } \
+ gen_qemu_##loadop(ctx, gpr, t0); \
+ tcg_gen_mov_tl(cpu_reserve, t0); \
+ tcg_gen_st_tl(gpr, cpu_env, offsetof(CPUPPCState, reserve_val)); \
+ tcg_temp_free(t0); \
}
+/* lwarx */
+LARX(lbarx, 1, ld8u);
+LARX(lharx, 2, ld16u);
+LARX(lwarx, 4, ld32u);
+
+
#if defined(CONFIG_USER_ONLY)
static void gen_conditional_store (DisasContext *ctx, TCGv EA,
int reg, int size)
@@ -3279,19 +3287,7 @@ static void gen_stwcx_(DisasContext *ctx)
#if defined(TARGET_PPC64)
/* ldarx */
-static void gen_ldarx(DisasContext *ctx)
-{
- TCGv t0;
- TCGv gpr = cpu_gpr[rD(ctx->opcode)];
- gen_set_access_type(ctx, ACCESS_RES);
- t0 = tcg_temp_local_new();
- gen_addr_reg_index(ctx, t0);
- gen_check_align(ctx, t0, 0x07);
- gen_qemu_ld64(ctx, gpr, t0);
- tcg_gen_mov_tl(cpu_reserve, t0);
- tcg_gen_st_tl(gpr, cpu_env, offsetof(CPUPPCState, reserve_val));
- tcg_temp_free(t0);
-}
+LARX(ldarx, 8, ld64);
/* stdcx. */
static void gen_stdcx_(DisasContext *ctx)
@@ -9461,6 +9457,8 @@ GEN_HANDLER(stswi, 0x1F, 0x15, 0x16, 0x00000001, PPC_STRING),
GEN_HANDLER(stswx, 0x1F, 0x15, 0x14, 0x00000001, PPC_STRING),
GEN_HANDLER(eieio, 0x1F, 0x16, 0x1A, 0x03FFF801, PPC_MEM_EIEIO),
GEN_HANDLER(isync, 0x13, 0x16, 0x04, 0x03FFF801, PPC_MEM),
+GEN_HANDLER_E(lbarx, 0x1F, 0x14, 0x01, 0x00000000, PPC_NONE, PPC2_ISA206),
+GEN_HANDLER_E(lharx, 0x1F, 0x14, 0x03, 0x00000000, PPC_NONE, PPC2_ISA206),
GEN_HANDLER(lwarx, 0x1F, 0x14, 0x00, 0x00000000, PPC_RES),
GEN_HANDLER2(stwcx_, "stwcx.", 0x1F, 0x16, 0x04, 0x00000000, PPC_RES),
#if defined(TARGET_PPC64)
--
1.7.1
next prev parent reply other threads:[~2013-12-18 20:49 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 20:48 [Qemu-devel] [V3 PATCH 00/14] target-ppc: Base ISA V2.06 for Power7/Power8 Tom Musta
2013-12-18 20:48 ` [Qemu-devel] [V3 PATCH 01/14] target-ppc: Add Flag for Power ISA V2.06 Tom Musta
2013-12-24 15:11 ` Richard Henderson
2013-12-18 20:48 ` [Qemu-devel] [V3 PATCH 02/14] target-ppc: Add ISA2.06 bpermd Instruction Tom Musta
2013-12-24 15:17 ` Richard Henderson
2013-12-28 0:23 ` Scott Wood
2013-12-30 14:48 ` Richard Henderson
2013-12-30 15:43 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2013-12-30 16:23 ` Richard Henderson
2013-12-28 0:27 ` [Qemu-devel] " Scott Wood
2013-12-18 20:48 ` [Qemu-devel] [V3 PATCH 03/14] target-ppc: Add ISA2.06 divdeu[o] Instructions Tom Musta
2013-12-24 15:20 ` Richard Henderson
2013-12-28 0:30 ` [Qemu-devel] [Qemu-ppc] " Scott Wood
2014-01-03 19:24 ` Tom Musta
2014-01-03 19:43 ` Scott Wood
2013-12-18 20:48 ` [Qemu-devel] [V3 PATCH 04/14] target-ppc: Add ISA2.06 divde[o] Instructions Tom Musta
2013-12-24 15:22 ` Richard Henderson
2013-12-18 20:48 ` [Qemu-devel] [V3 PATCH 05/14] target-ppc: Add ISA 2.06 divwe[u][o] Instructions Tom Musta
2013-12-24 15:26 ` Richard Henderson
2013-12-18 20:48 ` Tom Musta [this message]
2013-12-24 15:28 ` [Qemu-devel] [V3 PATCH 06/14] target-ppc: Add ISA2.06 lbarx, lharx Instructions Richard Henderson
2013-12-18 20:49 ` [Qemu-devel] [V3 PATCH 07/14] target-ppc: Add ISA 2.06 stbcx. and sthcx. Instructions Tom Musta
2013-12-24 15:31 ` Richard Henderson
2013-12-18 20:49 ` [Qemu-devel] [V3 PATCH 08/14] target-ppc: Add ISA2.06 Float to Integer Instructions Tom Musta
2013-12-24 15:36 ` Richard Henderson
2013-12-18 20:49 ` [Qemu-devel] [V3 PATCH 09/14] target-ppc: Add ISA 2.06 fcfid[u][s] Instructions Tom Musta
2013-12-24 15:41 ` Richard Henderson
2013-12-18 20:49 ` [Qemu-devel] [V3 PATCH 10/14] target-ppc: Fix and enable fri[mnpz] Tom Musta
2013-12-24 16:02 ` Richard Henderson
2014-01-06 20:06 ` Tom Musta
2013-12-18 20:49 ` [Qemu-devel] [V3 PATCH 11/14] target-ppc: Add ISA 2.06 ftdiv Instruction Tom Musta
2013-12-24 16:06 ` Richard Henderson
2013-12-18 20:49 ` [Qemu-devel] [V3 PATCH 12/14] target-ppc: Add ISA 2.06 ftsqrt Tom Musta
2013-12-24 16:07 ` Richard Henderson
2013-12-18 20:49 ` [Qemu-devel] [V3 PATCH 13/14] target-ppc: Enable frsqrtes on Power7 and Power8 Tom Musta
2013-12-24 16:07 ` Richard Henderson
2013-12-18 20:49 ` [Qemu-devel] [V3 PATCH 14/14] target-ppc: Add ISA2.06 lfiwzx Instruction Tom Musta
2013-12-24 16:09 ` Richard Henderson
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=1387399747-4994-7-git-send-email-tommusta@gmail.com \
--to=tommusta@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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).