Arm Linux EABI syscall support.
[qemu] / target-ppc / helper.c
index 66c2604..3f7a708 100644 (file)
@@ -806,7 +806,9 @@ void do_compute_hflags (CPUPPCState *env)
 }
 
 void do_store_msr (CPUPPCState *env, target_ulong value)
-    {
+{
+    int enter_pm;
+
     value &= env->msr_mask;
     if (((value >> MSR_IR) & 1) != msr_ir ||
         ((value >> MSR_DR) & 1) != msr_dr) {
@@ -846,6 +848,22 @@ void do_store_msr (CPUPPCState *env, target_ulong value)
     msr_ri  = (value >> MSR_RI)  & 1;
     msr_le  = (value >> MSR_LE)  & 1;
     do_compute_hflags(env);
+
+    enter_pm = 0;
+    switch (PPC_EXCP(env)) {
+    case PPC_FLAGS_EXCP_7x0:
+       if (msr_pow == 1 && (env->spr[SPR_HID0] & 0x00E00000) != 0)
+            enter_pm = 1;
+        break;
+    default:
+        break;
+    }
+    if (enter_pm) {
+        /* power save: exit cpu loop */
+        env->halted = 1;
+        env->exception_index = EXCP_HLT;
+        cpu_loop_exit();
+    }
 }
 
 float64 do_load_fpscr (CPUPPCState *env)
@@ -1436,15 +1454,5 @@ void do_interrupt (CPUState *env)
     /* Jump to handler */
     env->nip = excp;
     env->exception_index = EXCP_NONE;
-#if 0
-    /* ensure that no TB jump will be modified as
-       the program flow was changed */
-#ifdef __sparc__
-    tmp_T0 = 0;
-#else
-    T0 = 0;
-#endif
-#endif
-    env->interrupt_request |= CPU_INTERRUPT_EXITTB;
 }
 #endif /* !CONFIG_USER_ONLY */