ARM CPU suspend/halt (Paul Brook)
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sat, 26 Nov 2005 10:46:39 +0000 (10:46 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sat, 26 Nov 2005 10:46:39 +0000 (10:46 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1663 c046a42c-6fe2-441c-8c8c-71466251a162

cpu-exec.c
target-arm/cpu.h
target-arm/op.c
target-arm/translate.c

index f411eccf8138a960dedc0a99abea8081544ad92b..cddea532a42e901539c506192b11a8587125d0dc 100644 (file)
@@ -274,6 +274,17 @@ int cpu_exec(CPUState *env1)
             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; 
index 1c1233c198d1fbc33c9b90b753110874d9153136..3b36839e4b236a15a52c1d0c6a3c434a6b84f465 100644 (file)
@@ -90,7 +90,7 @@ typedef struct CPUARMState {
     int exception_index;
     int interrupt_request;
     int user_mode_only;
-    uint32_t address;
+    int halted;
 
     /* VFP coprocessor state.  */
     struct {
index 09449f28e461eb88cb001103fcef5653a035188a..35419a1b71b40e70a0e97bfc382551b20e74ec6c 100644 (file)
@@ -878,6 +878,13 @@ void OPPROTO op_debug(void)
     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.  */
index 8df10bebc8b21b579f00d9e924bcdf43be541327..930826cab98d353fbf4767a462e7cc66f1582994 100644 (file)
@@ -496,6 +496,15 @@ static int disas_cp15_insn(DisasContext *s, uint32_t insn)
     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);