target-alpha: Implement HALT IPR.
authorRichard Henderson <rth@twiddle.net>
Wed, 27 Apr 2011 16:22:52 +0000 (09:22 -0700)
committerRichard Henderson <rth@twiddle.net>
Sat, 8 Oct 2011 15:49:09 +0000 (08:49 -0700)
Signed-off-by: Richard Henderson <rth@twiddle.net>
target-alpha/helper.h
target-alpha/op_helper.c
target-alpha/translate.c

index 2dec57e44b25f31b329464e681ccc93fa8700f48..c352c2493ebbe08ecf150758dec47bb7c224b916 100644 (file)
@@ -113,6 +113,7 @@ DEF_HELPER_2(stq_c_phys, i64, i64, i64)
 
 DEF_HELPER_FLAGS_0(tbia, TCG_CALL_CONST, void)
 DEF_HELPER_FLAGS_1(tbis, TCG_CALL_CONST, void, i64)
+DEF_HELPER_1(halt, void, i64);
 #endif
 
 #include "def-helper.h"
index d8945dcbcac989c94a7837179586fd9568d6d69c..1896ab8b0090b6df4f65b1d650e3fd17485f5a6a 100644 (file)
@@ -22,6 +22,7 @@
 #include "host-utils.h"
 #include "softfloat.h"
 #include "helper.h"
+#include "sysemu.h"
 #include "qemu-timer.h"
 
 #define FP_STATUS (env->fp_status)
@@ -1218,6 +1219,15 @@ void helper_tbis(uint64_t p)
 {
     tlb_flush_page(env, p);
 }
+
+void helper_halt(uint64_t restart)
+{
+    if (restart) {
+        qemu_system_reset_request();
+    } else {
+        qemu_system_shutdown_request();
+    }
+}
 #endif
 
 /*****************************************************************************/
index c1ef4656794fa70fb8430c6c20e1351f9ab80928..0acbd682d300b8962c6ab5d4821e1d2e009bf4e3 100644 (file)
@@ -1645,6 +1645,11 @@ static ExitStatus gen_mtpr(DisasContext *ctx, int rb, int regno)
         tcg_gen_st32_i64(tmp, cpu_env, offsetof(CPUState, halted));
         return gen_excp(ctx, EXCP_HLT, 0);
 
+    case 252:
+        /* HALT */
+        gen_helper_halt(tmp);
+        return EXIT_PC_STALE;
+
     default:
         /* The basic registers are data only, and unknown registers
            are read-zero, write-ignore.  */