2727
static inline void gen_check_tlb_flush(DisasContext *ctx, bool global) { }
2728
#endif
2729
2730
-/* wait */
2731
-static void gen_wait(DisasContext *ctx)
2732
-{
2733
- uint32_t wc;
2734
-
2735
- if (ctx->insns_flags & PPC_WAIT) {
2736
- /* v2.03-v2.07 define an older incompatible 'wait' encoding. */
2737
-
2738
- if (ctx->insns_flags2 & PPC2_PM_ISA206) {
2739
- /* v2.06 introduced the WC field. WC > 0 may be treated as no-op. */
2740
- wc = WC(ctx->opcode);
2741
- } else {
2742
- wc = 0;
2743
- }
2744
-
2745
- } else if (ctx->insns_flags2 & PPC2_ISA300) {
2746
- /* v3.0 defines a new 'wait' encoding. */
2747
- wc = WC(ctx->opcode);
2748
- if (ctx->insns_flags2 & PPC2_ISA310) {
2749
- uint32_t pl = PL(ctx->opcode);
2750
-
2751
- /* WC 1,2 may be treated as no-op. WC 3 is reserved. */
2752
- if (wc == 3) {
2753
- gen_invalid(ctx);
2754
- return;
2755
- }
2756
-
2757
- /* PL 1-3 are reserved. If WC=2 then the insn is treated as noop. */
2758
- if (pl > 0 && wc != 2) {
2759
- gen_invalid(ctx);
2760
- return;
2761
- }
2762
-
2763
- } else { /* ISA300 */
2764
- /* WC 1-3 are reserved */
2765
- if (wc > 0) {
2766
- gen_invalid(ctx);
2767
- return;
2768
- }
2769
- }
2770
-
2771
- } else {
2772
- warn_report("wait instruction decoded with wrong ISA flags.");
2773
- gen_invalid(ctx);
2774
- return;
2775
- }
2776
-
2777
- /*
2778
- * wait without WC field or with WC=0 waits for an exception / interrupt
2779
- * to occur.
2780
- */
2781
- if (wc == 0) {
2782
- TCGv_i32 t0 = tcg_constant_i32(1);
2783
- tcg_gen_st_i32(t0, tcg_env,
2784
- -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted));
2785
- /* Stop translation, as the CPU is supposed to sleep from now */
2786
- gen_exception_nip(ctx, EXCP_HLT, ctx->base.pc_next);
2787
- }
2788
-
2789
- /*
2790
- * Other wait types must not just wait until an exception occurs because
2791
- * ignoring their other wake-up conditions could cause a hang.
2792
- *
2793
- * For v2.06 and 2.07, wc=1,2,3 are architected but may be implemented as
2794
- * no-ops.
2795
- *
2796
- * wc=1 and wc=3 explicitly allow the instruction to be treated as a no-op.
2797
- *
2798
- * wc=2 waits for an implementation-specific condition, such could be
2799
- * always true, so it can be implemented as a no-op.
2800
- *
2801
- * For v3.1, wc=1,2 are architected but may be implemented as no-ops.
2802
- *
2803
- * wc=1 (waitrsv) waits for an exception or a reservation to be lost.
2804
- * Reservation-loss may have implementation-specific conditions, so it
2805
- * can be implemented as a no-op.
2806
- *
2807
- * wc=2 waits for an exception or an amount of time to pass. This
2808
- * amount is implementation-specific so it can be implemented as a
2809
- * no-op.
2810
- *
2811
- * ISA v3.1 allows for execution to resume "in the rare case of
2812
- * an implementation-dependent event", so in any case software must
2813
- * not depend on the architected resumption condition to become
2814
- * true, so no-op implementations should be architecturally correct
2815
- * (if suboptimal).
2816
- */
2817
-}
2818
-
2730
#if defined(TARGET_PPC64)
2731
static void gen_doze(DisasContext *ctx)
2732
{
5095
GEN_HANDLER(stswi, 0x1F, 0x15, 0x16, 0x00000001, PPC_STRING),
5096
GEN_HANDLER(stswx, 0x1F, 0x15, 0x14, 0x00000001, PPC_STRING),
5097
/* ISA v3.0 changed the extended opcode from 62 to 30 */
5187
-GEN_HANDLER(wait, 0x1F, 0x1E, 0x01, 0x039FF801, PPC_WAIT),
5188
-GEN_HANDLER_E(wait, 0x1F, 0x1E, 0x00, 0x039CF801, PPC_NONE, PPC2_ISA300),
5098
GEN_HANDLER(rfi, 0x13, 0x12, 0x01, 0x03FF8001, PPC_FLOW),
5099
#if defined(TARGET_PPC64)
5100
GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_64B),