diff --git a/qemu/target/s390x/translate.c b/qemu/target/s390x/translate.c index 993f2150..39b9821f 100644 --- a/qemu/target/s390x/translate.c +++ b/qemu/target/s390x/translate.c @@ -6896,6 +6896,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) switch (dc->base.is_jmp) { case DISAS_UNICORN_HALT: tcg_gen_insn_start(tcg_ctx, dc->base.pc_next, 0, 0); + update_psw_addr(dc); gen_helper_uc_s390x_exit(tcg_ctx, tcg_ctx->cpu_env); break; case DISAS_GOTO_TB: diff --git a/tests/unit/test_s390x.c b/tests/unit/test_s390x.c index 98d8c3ed..e3337235 100644 --- a/tests/unit/test_s390x.c +++ b/tests/unit/test_s390x.c @@ -14,7 +14,7 @@ static void uc_common_setup(uc_engine **uc, uc_arch arch, uc_mode mode, static void test_s390x_lr() { char code[] = "\x18\x23"; // lr %r2, %r3 - uint64_t r_r2, r_r3 = 0x114514; + uint64_t r_pc, r_r2, r_r3 = 0x114514; uc_engine *uc; uc_common_setup(&uc, UC_ARCH_S390X, UC_MODE_BIG_ENDIAN, code, @@ -25,8 +25,10 @@ static void test_s390x_lr() OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0)); OK(uc_reg_read(uc, UC_S390X_REG_R2, &r_r2)); + OK(uc_reg_read(uc, UC_S390X_REG_PC, &r_pc)); TEST_CHECK(r_r2 == 0x114514); + TEST_CHECK(r_pc == code_start + sizeof(code) - 1); OK(uc_close(uc)); }