qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <huth@tuxfamily.org>,
	rth@twiddle.net, Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH v2 5/5] target-m68k: increment/decrement with SP
Date: Fri, 13 Jan 2017 13:52:03 +0100	[thread overview]
Message-ID: <1484311923-28637-6-git-send-email-laurent@vivier.eu> (raw)
In-Reply-To: <1484311923-28637-1-git-send-email-laurent@vivier.eu>

On 680x0 family only.

Address Register indirect With postincrement:

When using the stack pointer (A7) with byte size data, the register
is incremented by two.

Address Register indirect With predecrement:

When using the stack pointer (A7) with byte size data, the register
is decremented by two.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target/m68k/translate.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index cf5d8dd..727c189 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -725,7 +725,12 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s,
         }
         reg = get_areg(s, reg0);
         tmp = tcg_temp_new();
-        tcg_gen_subi_i32(tmp, reg, opsize_bytes(opsize));
+        if (reg0 == 7 && opsize == OS_BYTE &&
+            m68k_feature(s->env, M68K_FEATURE_M68000)) {
+            tcg_gen_subi_i32(tmp, reg, 2);
+        } else {
+            tcg_gen_subi_i32(tmp, reg, opsize_bytes(opsize));
+        }
         return tmp;
     case 5: /* Indirect displacement.  */
         reg = get_areg(s, reg0);
@@ -801,7 +806,12 @@ static TCGv gen_ea_mode(CPUM68KState *env, DisasContext *s, int mode, int reg0,
         result = gen_ldst(s, opsize, reg, val, what);
         if (what == EA_STORE || !addrp) {
             TCGv tmp = tcg_temp_new();
-            tcg_gen_addi_i32(tmp, reg, opsize_bytes(opsize));
+            if (reg0 == 7 && opsize == OS_BYTE &&
+                m68k_feature(s->env, M68K_FEATURE_M68000)) {
+                tcg_gen_subi_i32(tmp, reg, 2);
+            } else {
+                tcg_gen_addi_i32(tmp, reg, opsize_bytes(opsize));
+            }
             delay_set_areg(s, reg0, tmp, true);
         }
         return result;
-- 
2.7.4

  parent reply	other threads:[~2017-01-13 12:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 12:51 [Qemu-devel] [PATCH v2 0/5] Fixes for target/m68k Laurent Vivier
2017-01-13 12:51 ` [Qemu-devel] [PATCH v2 1/5] target-m68k: fix bit operation with immediate value Laurent Vivier
2017-01-13 17:55   ` Richard Henderson
2017-01-13 18:23     ` Laurent Vivier
2017-01-13 18:25       ` Richard Henderson
2017-01-13 12:52 ` [Qemu-devel] [PATCH v2 2/5] target-m68k: fix gen_flush_flags() Laurent Vivier
2017-01-13 17:56   ` Richard Henderson
2017-01-13 12:52 ` [Qemu-devel] [PATCH v2 3/5] target-m68k: manage pre-dec et post-inc in CAS Laurent Vivier
2017-01-13 18:00   ` Richard Henderson
2017-01-13 12:52 ` [Qemu-devel] [PATCH v2 4/5] target-m68k: CAS doesn't need aligned access Laurent Vivier
2017-01-13 18:01   ` Richard Henderson
2017-01-13 12:52 ` Laurent Vivier [this message]
2017-01-13 12:57   ` [Qemu-devel] [PATCH v2 5/5] target-m68k: increment/decrement with SP Thomas Huth
2017-01-13 18:02   ` 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=1484311923-28637-6-git-send-email-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=huth@tuxfamily.org \
    --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).