ppc: tcg: add nap insn support
PATCH 1/2 ppc: tcg: add nap insn support
Add the emulation of insn "nap" for hypervisor
Signed-off-by Liu Ping Fan <[email protected]>
--- target-ppc/excp_helper.c | 4 ++++ target-ppc/helper.h | 1 + target-ppc/translate.c | 6 ++++++ 3 files changed, 11 insertions(+)
target-ppc/excp_helper.c +4 -0
@@ -889,6 +889,10 @@ void helper_hrfid(CPUPPCState *env)do_rfi (env, env->spr[SPR_HSRR0 ], env->spr[SPR_HSRR1 ], ~((target_ulong)0x783F0000), 0); } + +void helper_nap (CPUPPCState *env) +{ +}#endif /*****************************************************************************/
target-ppc/helper.h +1 -0
@@ -17,6 +17,7 @@ DEF_HELPER_1(rfmci, void, env)#if defined(TARGET_PPC64 ) DEF_HELPER_1(rfid, void, env) DEF_HELPER_1(hrfid, void, env) +DEF_HELPER_1(nap, void, env)#endif #endif
target-ppc/translate.c +6 -0
@@ -3798,6 +3798,11 @@ static void gen_hrfid(DisasContext *ctx)gen_sync_exception (ctx); #endif } + +static void gen_nap (DisasContext *ctx) +{ +gen_helper_nap (cpu_env); +}#endif /* sc */
@@ -8732,6 +8737,7 @@ GEN_HANDLER(rfi, 0x13, 0x12, 0x01, 0x03FF8001, PPC_FLOW),#if defined(TARGET_PPC64 )GEN_HANDLER (rfid,0x13 ,0x12 ,0x00 ,0x03FF8001 ,PPC_64B ),GEN_HANDLER (hrfid,0x13 ,0x12 ,0x08 ,0x03FF8001 ,PPC_64H ), +GEN_HANDLER (nap,0x13 ,0x12 ,0x0d ,0x03FF8001 ,PPC_64H ), #endifGEN_HANDLER (sc,0x11 ,0xFF ,0xFF ,0x03FFF01D ,PPC_FLOW ), GEN_HANDLER(tw, 0x1F, 0x04, 0x00, 0x00000001, PPC_FLOW),
Signature · 1 line
1.8.1.4
PATCH 2/2 ppc: tcg: implement helper_nap
When nap, clear no persistent register as ISA spec says.
Signed-off-by Liu Ping Fan <[email protected]>
--- target-ppc/excp_helper.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
target-ppc/excp_helper.c +14 -0
@@ -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
Signature · 1 line
1.8.1.4