Commit e80e1cc4b18d388227d2fa6b8551929a381d2490

Authored by bellard
1 parent f24e5695

halt state support for ppc


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1657 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-exec.c
... ... @@ -262,6 +262,16 @@ int cpu_exec(CPUState *env1)
262 262 return EXCP_HALTED;
263 263 }
264 264 }
  265 +#elif defined(TARGET_PPC)
  266 + if (env1->msr[MSR_POW]) {
  267 + if (env1->msr[MSR_EE] &&
  268 + (env1->interrupt_request &
  269 + (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER))) {
  270 + env1->msr[MSR_POW] = 0;
  271 + } else {
  272 + return EXCP_HALTED;
  273 + }
  274 + }
265 275 #endif
266 276  
267 277 cpu_single_env = env1;
... ...
monitor.c
... ... @@ -255,6 +255,10 @@ static void do_info_cpus(void)
255 255 term_printf(" pc=0x" TARGET_FMT_lx, env->eip + env->segs[R_CS].base);
256 256 if (env->hflags & HF_HALTED_MASK)
257 257 term_printf(" (halted)");
  258 +#elif defined(TARGET_PPC)
  259 + term_printf(" nip=0x" TARGET_FMT_lx, env->nip);
  260 + if (msr_pow)
  261 + term_printf(" (halted)");
258 262 #endif
259 263 term_printf("\n");
260 264 }
... ...
target-ppc/helper.c
... ... @@ -846,6 +846,11 @@ void do_store_msr (CPUPPCState *env, target_ulong value)
846 846 msr_ri = (value >> MSR_RI) & 1;
847 847 msr_le = (value >> MSR_LE) & 1;
848 848 do_compute_hflags(env);
  849 + if (msr_pow) {
  850 + /* power save: exit cpu loop */
  851 + env->exception_index = EXCP_HLT;
  852 + cpu_loop_exit();
  853 + }
849 854 }
850 855  
851 856 float64 do_load_fpscr (CPUPPCState *env)
... ...
target-ppc/translate.c
... ... @@ -2097,10 +2097,11 @@ GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001FF801, PPC_MISC)
2097 2097 RET_PRIVREG(ctx);
2098 2098 return;
2099 2099 }
  2100 + gen_op_update_nip((ctx)->nip);
2100 2101 gen_op_load_gpr_T0(rS(ctx->opcode));
2101 2102 gen_op_store_msr();
2102 2103 /* Must stop the translation as machine state (may have) changed */
2103   - RET_STOP(ctx);
  2104 + RET_CHG_FLOW(ctx);
2104 2105 #endif
2105 2106 }
2106 2107  
... ...