Patchwork [2/2] ppc: tcg: implement helper_nap

login
register
mail settings
Submitter pingfan liu
Date Jan. 6, 2014, 12:56 a.m.
Message ID <1388969791-4752-2-git-send-email-pingfank@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/307075/
State New
Headers show

Comments

pingfan liu - Jan. 6, 2014, 12:56 a.m.
When nap, clear no persistent register as ISA spec says.

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
 target-ppc/excp_helper.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch

diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
index a9712bc..5dbb166 100644
--- a/target-ppc/excp_helper.c
+++ b/target-ppc/excp_helper.c
@@ -892,6 +892,20 @@  void helper_hrfid(CPUPPCState *env)
 
 void helper_nap(CPUPPCState *env)
 {
+    int i;
+    for (i = 0; i < 32; i++) {
+        env->gpr[i] = 0;
+    }
+    env->lr = 0;
+    env->ctr = 0;
+    for (i = 0; i < 8; i++) {
+        env->crf[i] = 0;
+    }
+    env->msr = 0;
+    for (i = 0; i < 32; i++) {
+        env->fpr[i] = 0;
+    }
+
 }
 #endif