Commit 30032c940a625f0aa8f04becf78e47274ec3a319
1 parent
7dbe11ac
Fix missing nip updates for instructions that potentially generate
exceptions from op helpers. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3308 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
10 additions
and
0 deletions
target-ppc/translate.c
... | ... | @@ -2634,6 +2634,8 @@ static GenOpFunc *gen_op_stwcx[] = { |
2634 | 2634 | /* lwarx */ |
2635 | 2635 | GEN_HANDLER(lwarx, 0x1F, 0x14, 0x00, 0x00000001, PPC_RES) |
2636 | 2636 | { |
2637 | + /* NIP cannot be restored if the memory exception comes from an helper */ | |
2638 | + gen_update_nip(ctx, ctx->nip - 4); | |
2637 | 2639 | gen_addr_reg_index(ctx); |
2638 | 2640 | op_lwarx(); |
2639 | 2641 | gen_op_store_T1_gpr(rD(ctx->opcode)); |
... | ... | @@ -2642,6 +2644,8 @@ GEN_HANDLER(lwarx, 0x1F, 0x14, 0x00, 0x00000001, PPC_RES) |
2642 | 2644 | /* stwcx. */ |
2643 | 2645 | GEN_HANDLER(stwcx_, 0x1F, 0x16, 0x04, 0x00000000, PPC_RES) |
2644 | 2646 | { |
2647 | + /* NIP cannot be restored if the memory exception comes from an helper */ | |
2648 | + gen_update_nip(ctx, ctx->nip - 4); | |
2645 | 2649 | gen_addr_reg_index(ctx); |
2646 | 2650 | gen_op_load_gpr_T1(rS(ctx->opcode)); |
2647 | 2651 | op_stwcx(); |
... | ... | @@ -2689,6 +2693,8 @@ static GenOpFunc *gen_op_stdcx[] = { |
2689 | 2693 | /* ldarx */ |
2690 | 2694 | GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_64B) |
2691 | 2695 | { |
2696 | + /* NIP cannot be restored if the memory exception comes from an helper */ | |
2697 | + gen_update_nip(ctx, ctx->nip - 4); | |
2692 | 2698 | gen_addr_reg_index(ctx); |
2693 | 2699 | op_ldarx(); |
2694 | 2700 | gen_op_store_T1_gpr(rD(ctx->opcode)); |
... | ... | @@ -2697,6 +2703,8 @@ GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_64B) |
2697 | 2703 | /* stdcx. */ |
2698 | 2704 | GEN_HANDLER(stdcx_, 0x1F, 0x16, 0x06, 0x00000000, PPC_64B) |
2699 | 2705 | { |
2706 | + /* NIP cannot be restored if the memory exception comes from an helper */ | |
2707 | + gen_update_nip(ctx, ctx->nip - 4); | |
2700 | 2708 | gen_addr_reg_index(ctx); |
2701 | 2709 | gen_op_load_gpr_T1(rS(ctx->opcode)); |
2702 | 2710 | op_stdcx(); |
... | ... | @@ -3612,6 +3620,8 @@ static GenOpFunc *gen_op_icbi[] = { |
3612 | 3620 | |
3613 | 3621 | GEN_HANDLER(icbi, 0x1F, 0x16, 0x1E, 0x03E00001, PPC_CACHE) |
3614 | 3622 | { |
3623 | + /* NIP cannot be restored if the memory exception comes from an helper */ | |
3624 | + gen_update_nip(ctx, ctx->nip - 4); | |
3615 | 3625 | gen_addr_reg_index(ctx); |
3616 | 3626 | op_icbi(); |
3617 | 3627 | } | ... | ... |