qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [patch] Arm CPU halt support
Date: Fri, 25 Nov 2005 23:22:43 +0000	[thread overview]
Message-ID: <200511252322.43616.paul@codesourcery.com> (raw)

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

The attached patch implements Arm CPU suspend/halt.

Paul

[-- Attachment #2: patch.qemu_arm_halt --]
[-- Type: text/x-diff, Size: 2032 bytes --]

=== cpu-exec.c
==================================================================
--- cpu-exec.c	(revision 1861)
+++ cpu-exec.c	(local)
@@ -274,6 +274,17 @@
             return EXCP_HALTED;
         }
     }
+#elif defined(TARGET_ARM)
+    if (env1->halted) {
+        /* An interrupt wakes the CPU even if the I and F CPSR bits are
+           set.  */
+        if (env1->interrupt_request
+            & (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD)) {
+            env1->halted = 0;
+        } else {
+            return EXCP_HALTED;
+        }
+    }
 #endif
 
     cpu_single_env = env1; 
=== target-arm/cpu.h
==================================================================
--- target-arm/cpu.h	(revision 1861)
+++ target-arm/cpu.h	(local)
@@ -90,7 +90,7 @@
     int exception_index;
     int interrupt_request;
     int user_mode_only;
-    uint32_t address;
+    int halted;
 
     /* VFP coprocessor state.  */
     struct {
=== target-arm/op.c
==================================================================
--- target-arm/op.c	(revision 1861)
+++ target-arm/op.c	(local)
@@ -878,6 +878,13 @@
     cpu_loop_exit();
 }
 
+void OPPROTO op_wfi(void)
+{
+    env->exception_index = EXCP_HLT;
+    env->halted = 1;
+    cpu_loop_exit();
+}
+
 /* VFP support.  We follow the convention used for VFP instrunctions:
    Single precition routines have a "s" suffix, double precision a
    "d" suffix.  */
=== target-arm/translate.c
==================================================================
--- target-arm/translate.c	(revision 1861)
+++ target-arm/translate.c	(local)
@@ -496,6 +496,15 @@
     if (IS_USER(s)) {
         return 1;
     }
+    if ((insn & 0x0fff0fff) == 0x0e070f90
+        || (insn & 0x0fff0fff) == 0x0e070f58) {
+        /* Wait for interrupt.  */
+        gen_op_movl_T0_im((long)s->pc);
+        gen_op_movl_reg_TN[0][15]();
+        gen_op_wfi();
+        s->is_jmp = DISAS_JUMP;
+        return 0;
+    }
     rd = (insn >> 12) & 0xf;
     if (insn & (1 << 20)) {
         gen_op_movl_T0_cp15(insn);

             reply	other threads:[~2005-11-25 23:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-25 23:22 Paul Brook [this message]
2005-11-26 11:10 ` [Qemu-devel] Re: [patch] Arm CPU halt support Antti P Miettinen

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=200511252322.43616.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --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).