qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5065] [sh4] sleep instruction
Date: Fri, 22 Aug 2008 08:57:27 +0000	[thread overview]
Message-ID: <E1KWSSV-000524-Iw@cvs.savannah.gnu.org> (raw)

Revision: 5065
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5065
Author:   aurel32
Date:     2008-08-22 08:57:27 +0000 (Fri, 22 Aug 2008)

Log Message:
-----------
[sh4] sleep instruction

This patch adds sleep instruction.

(Shin-ichiro KAWASAKI)

Modified Paths:
--------------
    trunk/target-sh4/cpu.h
    trunk/target-sh4/exec.h
    trunk/target-sh4/helper.c
    trunk/target-sh4/op.c
    trunk/target-sh4/translate.c

Modified: trunk/target-sh4/cpu.h
===================================================================
--- trunk/target-sh4/cpu.h	2008-08-22 08:57:19 UTC (rev 5064)
+++ trunk/target-sh4/cpu.h	2008-08-22 08:57:27 UTC (rev 5065)
@@ -117,6 +117,7 @@
      CPU_COMMON tlb_t utlb[UTLB_SIZE];	/* unified translation table */
     tlb_t itlb[ITLB_SIZE];	/* instruction translation table */
     void *intc_handle;
+    int intr_at_halt;		/* SR_BL ignored during sleep */
 } CPUSH4State;
 
 CPUSH4State *cpu_sh4_init(const char *cpu_model);

Modified: trunk/target-sh4/exec.h
===================================================================
--- trunk/target-sh4/exec.h	2008-08-22 08:57:19 UTC (rev 5064)
+++ trunk/target-sh4/exec.h	2008-08-22 08:57:27 UTC (rev 5065)
@@ -41,6 +41,7 @@
         return 0;
     if (env->interrupt_request & CPU_INTERRUPT_HARD) {
         env->halted = 0;
+        env->intr_at_halt = 1;
         return 0;
     }
     return EXCP_HALTED;

Modified: trunk/target-sh4/helper.c
===================================================================
--- trunk/target-sh4/helper.c	2008-08-22 08:57:19 UTC (rev 5064)
+++ trunk/target-sh4/helper.c	2008-08-22 08:57:27 UTC (rev 5065)
@@ -87,9 +87,10 @@
         if (do_exp && env->exception_index != 0x1e0) {
             env->exception_index = 0x000; /* masked exception -> reset */
         }
-        if (do_irq) {
+        if (do_irq && !env->intr_at_halt) {
             return; /* masked */
         }
+        env->intr_at_halt = 0;
     }
 
     if (do_irq) {

Modified: trunk/target-sh4/op.c
===================================================================
--- trunk/target-sh4/op.c	2008-08-22 08:57:19 UTC (rev 5064)
+++ trunk/target-sh4/op.c	2008-08-22 08:57:27 UTC (rev 5065)
@@ -1091,6 +1091,13 @@
     cpu_loop_exit();
 }
 
+void OPPROTO op_sleep(void)
+{
+    env->halted = 1;
+    env->exception_index = EXCP_HLT;
+    cpu_loop_exit();
+}
+
 /* Load and store */
 #define MEMSUFFIX _raw
 #include "op_mem.c"

Modified: trunk/target-sh4/translate.c
===================================================================
--- trunk/target-sh4/translate.c	2008-08-22 08:57:19 UTC (rev 5064)
+++ trunk/target-sh4/translate.c	2008-08-22 08:57:27 UTC (rev 5065)
@@ -298,7 +298,12 @@
     case 0x0009:		/* nop */
 	return;
     case 0x001b:		/* sleep */
-	assert(0);		/* XXXXX */
+	if (ctx->memidx) {
+		gen_op_sleep();
+	} else {
+		gen_op_raise_illegal_instruction();
+		ctx->bstate = BS_EXCP;
+	}
 	return;
     }
 

                 reply	other threads:[~2008-08-22  8:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1KWSSV-000524-Iw@cvs.savannah.gnu.org \
    --to=aurelien@aurel32.net \
    --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).