Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew STUBBS <andrew.stubbs@st.com>
To: GDB Patches <gdb-patches@sourceware.org>
Subject: [PATCH] SH simulator illegal instructions
Date: Mon, 24 Sep 2007 14:44:00 -0000	[thread overview]
Message-ID: <46F7CD53.704@st.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

Hi,

The SH simulator currently accepts some instructions in delay slots that 
should not be allowed.

Specifically:
	mov.l @(<disp>,PC),<REG_N>
	mov.w @(<disp>,PC),<REG_N>
	mova @(<disp>,PC),R0

I have checked the remaining SH-4 instructions, and don't believe there 
are any more, however I have not checked other architecture variants.

The attached patch add the proper check.

:ADDPATCH sh sim:

Andrew Stubbs

[-- Attachment #2: illslot.patch --]
[-- Type: text/plain, Size: 937 bytes --]

2007-09-24  Andrew Stubbs  <andrew.stubbs@st.com>

	* gencode.c (tab): Add RAISE_EXCEPTION_IF_IN_DELAY_SLOT to the
	definition of PC relative 'mov.l'/'mov.w' and also 'mova'.

--- orig/sim/sh/gencode.c	2007-03-06 13:58:46.000000000 +0000
+++ src/sim/sh/gencode.c	2007-09-24 15:02:18.000000000 +0100
@@ -993,6 +993,7 @@
     "L (0);",
   },
   { "n", "", "mov.l @(<disp>,PC),<REG_N>", "1101nnnni8p4....",
+    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "MA (1);",
     "R[n] = RLAT ((PH2T (PC) & ~3) + 4 + i);",
     "L (n);",
@@ -1059,6 +1060,7 @@
     "L (0);",
   },
   { "n", "", "mov.w @(<disp>,PC),<REG_N>", "1001nnnni8p2....",
+    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "MA (1);",
     "R[n] = RSWAT (PH2T (PC + 4 + i));",
     "L (n);",
@@ -1120,6 +1122,7 @@
   },
 
   { "0", "", "mova @(<disp>,PC),R0", "11000111i8p4....",
+    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "R0 = ((i + 4 + PH2T (PC)) & ~0x3);",
   },
 

             reply	other threads:[~2007-09-24 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 14:44 Andrew STUBBS [this message]
2007-10-06 15:58 ` Daniel Jacobowitz
2007-10-08 11:18   ` Andrew STUBBS
2007-10-08 11:59     ` Denis PILAT
2007-10-08 13:00       ` Andrew STUBBS

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=46F7CD53.704@st.com \
    --to=andrew.stubbs@st.com \
    --cc=gdb-patches@sourceware.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