qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Pavel Dovgalyuk" <dovgaluk@ispras.ru>
To: 'Laurent Vivier' <laurent@vivier.eu>,
	'Pavel Dovgalyuk' <Pavel.Dovgaluk@ispras.ru>,
	qemu-devel@nongnu.org
Cc: huth@tuxfamily.org
Subject: Re: [Qemu-devel] [PATCH v4] m68k: implement movep instruction
Date: Tue, 6 Feb 2018 16:30:07 +0300	[thread overview]
Message-ID: <000c01d39f4e$9af80f90$d0e82eb0$@ru> (raw)
In-Reply-To: <0dfe3d4e-fc7e-8fdf-214c-f1c7a0b6f027@vivier.eu>

> From: Laurent Vivier [mailto:laurent@vivier.eu]
> Le 06/02/2018 à 13:44, Pavel Dovgalyuk a écrit :
> > This patch implements movep instruction. It moves data between a data register
> > and alternate bytes within the address space starting at the location
> > specified and incrementing by two.
> >
> > It was designed for the original 68000 and used in firmwares for
> > interfacing the 8-bit peripherals through the 16-bit data bus.
> 
> Did you test this change with some kind of firmware?

Yes, we implemented this instruction when tried to emulate Macintosh-128k on Qemu.

> > Without this patch opcode for this instruction is recognized as some bitop.
> >
> > Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> > Signed-off-by: Mihail Abakumov <mikhail.abakumov@ispras.ru>
> >
> > --
> >
> > v4: - fixed offset calculation misprint
> >
> > v3: - simplified movep function code
> >     - joined movep masks
> >
> > v2: - disabled movep for Coldfire
> >     - fixed gen_store/load usage
> > ---
> >  target/m68k/cpu.c       |    2 ++
> >  target/m68k/cpu.h       |    1 +
> >  target/m68k/translate.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 49 insertions(+)
> 
> Tested-by: Laurent Vivier <laurent@vivier.eu>
> 
> I've checked we have the same result on a real 68040
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Thanks!

By the way, we also handled reset interrupt, but it is not compatible with other m68k platforms:

@@ -66,8 +66,9 @@ static void m68k_cpu_reset(CPUState *s)
     cpu_m68k_set_fpcr(env, 0);
     env->fpsr = 0;
 
-    /* TODO: We should set PC from the interrupt vector.  */
-    env->pc = 0;
+    env->vbr = 0;
+    /* PC and SP (for m68k) will be initialized by the reset handler */
+    s->exception_index = EXCP_RESET;
 }

@@ -378,6 +380,8 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
         cpu_m68k_set_sr(env, sr &= ~SR_M);
         sp = env->aregs[7] & ~1;
         do_stack_frame(env, &sp, 1, oldsr, 0, retaddr);
+    } else if (cs->exception_index == EXCP_RESET) {
+        sp = cpu_ldl_kernel(env, env->vbr + vector - 4);
     } else {
         do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
     }

Pavel Dovgalyuk

  reply	other threads:[~2018-02-06 13:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 12:44 [Qemu-devel] [PATCH v4] m68k: implement movep instruction Pavel Dovgalyuk
2018-02-06 13:27 ` Laurent Vivier
2018-02-06 13:30   ` Pavel Dovgalyuk [this message]
2018-02-06 13:36     ` Laurent Vivier
2018-02-07  7:40       ` Pavel Dovgalyuk

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='000c01d39f4e$9af80f90$d0e82eb0$@ru' \
    --to=dovgaluk@ispras.ru \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=huth@tuxfamily.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@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).