aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-11-26 20:15:14 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-11-26 20:15:14 +0000
commit50443c98e4149e8cde3b371f9ed60d943d95d286 (patch)
tree1d091d1e6bd2311470eab59ec5f08cae89c0f4f9 /target-ppc
parentfixed async signal support for tb_phys_invalidate() (diff)
downloadqemu-kvm-50443c98e4149e8cde3b371f9ed60d943d95d286.tar.gz
qemu-kvm-50443c98e4149e8cde3b371f9ed60d943d95d286.tar.bz2
qemu-kvm-50443c98e4149e8cde3b371f9ed60d943d95d286.zip
specialize the power save code for 7x0 CPUs
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1671 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc')
-rw-r--r--target-ppc/cpu.h2
-rw-r--r--target-ppc/helper.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index fa7f524e9..88d91358e 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -495,6 +495,8 @@ struct CPUPPCState {
CPU_COMMON
+ int halted; /* TRUE if the CPU is in suspend state */
+
int access_type; /* when a memory exception occurs, the access
type is stored here */
diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index ff1355c54..3f7a70871 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -807,6 +807,8 @@ 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,8 +848,19 @@ 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);
- if (msr_pow) {
+
+ 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();
}