]> Git Repo - qemu.git/commitdiff
[sh4] sleep instruction
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 22 Aug 2008 08:57:27 +0000 (08:57 +0000)
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 22 Aug 2008 08:57:27 +0000 (08:57 +0000)
This patch adds sleep instruction.

(Shin-ichiro KAWASAKI)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5065 c046a42c-6fe2-441c-8c8c-71466251a162

target-sh4/cpu.h
target-sh4/exec.h
target-sh4/helper.c
target-sh4/op.c
target-sh4/translate.c

index 9dbadf4d32b7a9bbeefd98f0341fa99806fe0493..601cb247cca545c1fc942f33c25ef001ffc3f6da 100644 (file)
@@ -117,6 +117,7 @@ typedef struct CPUSH4State {
      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);
index 2d333761f8d0f5528e569f7cd69f999b3002e719..544dc0f1b13db1bf4c7472f206103192ebbd5810 100644 (file)
@@ -41,6 +41,7 @@ static inline int cpu_halted(CPUState *env) {
         return 0;
     if (env->interrupt_request & CPU_INTERRUPT_HARD) {
         env->halted = 0;
+        env->intr_at_halt = 1;
         return 0;
     }
     return EXCP_HALTED;
index 917f02f80608ec64e1599972c8c0bc1b90522a61..bdbf70ebaba9d72abf6ab247d40f61ee12e9314b 100644 (file)
@@ -87,9 +87,10 @@ void do_interrupt(CPUState * env)
         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) {
index 22d49138fbe821bd91ad54ee73fa0c76d6045603..37ac93099a989abff5a6d9c7702f60a71217789e 100644 (file)
@@ -1091,6 +1091,13 @@ void OPPROTO op_debug(void)
     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"
index 15500a6c7343fabaca403d3fedac70ed00d4d113..6f9fe33d3e3a37656e51d97f07ccfbc94ea12864 100644 (file)
@@ -298,7 +298,12 @@ void _decode_opc(DisasContext * ctx)
     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;
     }
 
This page took 0.035306 seconds and 4 git commands to generate.