target/hppa: Fix diag instructions to set/restore shadow registers
PATCH 1/1 target/hppa: Fix diag instructions to set/restore shadow registers
The 32-bit 7300LC CPU and the 64-bit PCX-W 8500 CPU use different diag instructions to save or restore the CPU registers to/from the shadow registers.
Implement those per-CPU architecture diag instructions to fix those parts of the HP ODE testcases (L2DIAG and WDIAG, section 1) which test the shadow registers.
Signed-off-by Helge Deller <[email protected]>
target/hppa/helper.h +1 -0
@@ -86,6 +86,7 @@ DEF_HELPER_FLAGS_0(read_interval_timer, TCG_CALL_NO_RWG, tl)#ifndef CONFIG_USER_ONLY DEF_HELPER_1(halt, noreturn, env) DEF_HELPER_1(reset, noreturn, env) +DEF_HELPER_1(putshadowregs, void, env) DEF_HELPER_1(getshadowregs, void, env) DEF_HELPER_1(rfi, void, env)DEF_HELPER_1 (rfi_r, void, env)
target/hppa/sys_helper.c +11 -0
@@ -95,6 +95,17 @@ void HELPER(rfi)(CPUHPPAState *env)cpu_hppa_put_psw (env, env->cr[CR_IPSW ]); } +void HELPER (putshadowregs )(CPUHPPAState *env) +{ + env->shadow[0 ] = env->gr[1 ]; + env->shadow[1 ] = env->gr[8 ]; + env->shadow[2 ] = env->gr[9 ]; + env->shadow[3 ] = env->gr[16 ]; + env->shadow[4 ] = env->gr[17 ]; + env->shadow[5 ] = env->gr[24 ]; + env->shadow[6 ] = env->gr[25 ]; +} +void HELPER (getshadowregs )(CPUHPPAState *env) { env->gr[1 ] = env->shadow[0 ];
target/hppa/translate.c +12 -0
@@ -4533,6 +4533,18 @@ static bool trans_diag(DisasContext *ctx, arg_diag *a)gen_helper_diag_console_output (tcg_env); return nullify_end(ctx); } +if ((ctx->is_pa20 && a->i ==0x701840 ) || + (!ctx->is_pa20 && a->i ==0x1a40 )) { +/* save shadow registers */ +nullify_over (ctx); +gen_helper_putshadowregs (tcg_env); +return nullify_end (ctx); + } +if ((ctx->is_pa20 && a->i ==0x781840 ) || + (!ctx->is_pa20 && a->i ==0x1a00 )) { +/* restore shadow registers */ +return trans_getshadowregs (ctx,NULL ); + }#endif qemu_log_mask (LOG_UNIMP ,"DIAG opcode 0x%04x ignored\n" , a->i);return true;