Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify |
| 3 | * it under the terms of the GNU General Public License, version 2, as |
| 4 | * published by the Free Software Foundation. |
| 5 | * |
| 6 | * This program is distributed in the hope that it will be useful, |
| 7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 9 | * GNU General Public License for more details. |
| 10 | * |
| 11 | * You should have received a copy of the GNU General Public License |
| 12 | * along with this program; if not, write to the Free Software |
| 13 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 14 | * |
| 15 | * Copyright IBM Corp. 2007 |
| 16 | * |
| 17 | * Authors: Hollis Blanchard <hollisb@us.ibm.com> |
| 18 | */ |
| 19 | |
| 20 | #include <linux/jiffies.h> |
Alexander Graf | 544c676 | 2009-11-02 12:02:31 +0000 | [diff] [blame] | 21 | #include <linux/hrtimer.h> |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 22 | #include <linux/types.h> |
| 23 | #include <linux/string.h> |
| 24 | #include <linux/kvm_host.h> |
| 25 | |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 26 | #include <asm/reg.h> |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 27 | #include <asm/time.h> |
| 28 | #include <asm/byteorder.h> |
| 29 | #include <asm/kvm_ppc.h> |
Hollis Blanchard | c381a04 | 2008-11-05 09:36:15 -0600 | [diff] [blame] | 30 | #include <asm/disassemble.h> |
Hollis Blanchard | 73e75b4 | 2008-12-02 15:51:57 -0600 | [diff] [blame] | 31 | #include "timing.h" |
Marcelo Tosatti | 46f43c6 | 2009-06-18 11:47:27 -0300 | [diff] [blame] | 32 | #include "trace.h" |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 33 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 34 | #define OP_TRAP 3 |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 35 | #define OP_TRAP_64 2 |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 36 | |
| 37 | #define OP_31_XOP_LWZX 23 |
| 38 | #define OP_31_XOP_LBZX 87 |
| 39 | #define OP_31_XOP_STWX 151 |
| 40 | #define OP_31_XOP_STBX 215 |
Alexander Graf | 1c85e73 | 2010-03-24 21:48:27 +0100 | [diff] [blame] | 41 | #define OP_31_XOP_LBZUX 119 |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 42 | #define OP_31_XOP_STBUX 247 |
| 43 | #define OP_31_XOP_LHZX 279 |
| 44 | #define OP_31_XOP_LHZUX 311 |
| 45 | #define OP_31_XOP_MFSPR 339 |
Alexander Graf | 1c85e73 | 2010-03-24 21:48:27 +0100 | [diff] [blame] | 46 | #define OP_31_XOP_LHAX 343 |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 47 | #define OP_31_XOP_STHX 407 |
| 48 | #define OP_31_XOP_STHUX 439 |
| 49 | #define OP_31_XOP_MTSPR 467 |
| 50 | #define OP_31_XOP_DCBI 470 |
| 51 | #define OP_31_XOP_LWBRX 534 |
| 52 | #define OP_31_XOP_TLBSYNC 566 |
| 53 | #define OP_31_XOP_STWBRX 662 |
| 54 | #define OP_31_XOP_LHBRX 790 |
| 55 | #define OP_31_XOP_STHBRX 918 |
| 56 | |
| 57 | #define OP_LWZ 32 |
| 58 | #define OP_LWZU 33 |
| 59 | #define OP_LBZ 34 |
| 60 | #define OP_LBZU 35 |
| 61 | #define OP_STW 36 |
| 62 | #define OP_STWU 37 |
| 63 | #define OP_STB 38 |
| 64 | #define OP_STBU 39 |
| 65 | #define OP_LHZ 40 |
| 66 | #define OP_LHZU 41 |
Alexander Graf | 3587d53 | 2010-02-19 11:00:30 +0100 | [diff] [blame] | 67 | #define OP_LHA 42 |
| 68 | #define OP_LHAU 43 |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 69 | #define OP_STH 44 |
| 70 | #define OP_STHU 45 |
| 71 | |
Alexander Graf | 00c3a37 | 2010-04-16 00:11:42 +0200 | [diff] [blame^] | 72 | #ifdef CONFIG_PPC_BOOK3S |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 73 | static int kvmppc_dec_enabled(struct kvm_vcpu *vcpu) |
| 74 | { |
| 75 | return 1; |
| 76 | } |
| 77 | #else |
| 78 | static int kvmppc_dec_enabled(struct kvm_vcpu *vcpu) |
| 79 | { |
| 80 | return vcpu->arch.tcr & TCR_DIE; |
| 81 | } |
| 82 | #endif |
| 83 | |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 84 | void kvmppc_emulate_dec(struct kvm_vcpu *vcpu) |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 85 | { |
Alexander Graf | 544c676 | 2009-11-02 12:02:31 +0000 | [diff] [blame] | 86 | unsigned long dec_nsec; |
Alexander Graf | 9a7a9b0 | 2009-10-30 05:47:15 +0000 | [diff] [blame] | 87 | |
Alexander Graf | 544c676 | 2009-11-02 12:02:31 +0000 | [diff] [blame] | 88 | pr_debug("mtDEC: %x\n", vcpu->arch.dec); |
Alexander Graf | 00c3a37 | 2010-04-16 00:11:42 +0200 | [diff] [blame^] | 89 | #ifdef CONFIG_PPC_BOOK3S |
Alexander Graf | 7706664d | 2009-12-21 20:21:24 +0100 | [diff] [blame] | 90 | /* mtdec lowers the interrupt line when positive. */ |
| 91 | kvmppc_core_dequeue_dec(vcpu); |
| 92 | |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 93 | /* POWER4+ triggers a dec interrupt if the value is < 0 */ |
| 94 | if (vcpu->arch.dec & 0x80000000) { |
Alexander Graf | 544c676 | 2009-11-02 12:02:31 +0000 | [diff] [blame] | 95 | hrtimer_try_to_cancel(&vcpu->arch.dec_timer); |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 96 | kvmppc_core_queue_dec(vcpu); |
| 97 | return; |
| 98 | } |
| 99 | #endif |
| 100 | if (kvmppc_dec_enabled(vcpu)) { |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 101 | /* The decrementer ticks at the same rate as the timebase, so |
| 102 | * that's how we convert the guest DEC value to the number of |
| 103 | * host ticks. */ |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 104 | |
Alexander Graf | 544c676 | 2009-11-02 12:02:31 +0000 | [diff] [blame] | 105 | hrtimer_try_to_cancel(&vcpu->arch.dec_timer); |
| 106 | dec_nsec = vcpu->arch.dec; |
| 107 | dec_nsec *= 1000; |
| 108 | dec_nsec /= tb_ticks_per_usec; |
| 109 | hrtimer_start(&vcpu->arch.dec_timer, ktime_set(0, dec_nsec), |
| 110 | HRTIMER_MODE_REL); |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 111 | vcpu->arch.dec_jiffies = get_tb(); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 112 | } else { |
Alexander Graf | 544c676 | 2009-11-02 12:02:31 +0000 | [diff] [blame] | 113 | hrtimer_try_to_cancel(&vcpu->arch.dec_timer); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 114 | } |
| 115 | } |
| 116 | |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 117 | /* XXX to do: |
| 118 | * lhax |
| 119 | * lhaux |
| 120 | * lswx |
| 121 | * lswi |
| 122 | * stswx |
| 123 | * stswi |
| 124 | * lha |
| 125 | * lhau |
| 126 | * lmw |
| 127 | * stmw |
| 128 | * |
| 129 | * XXX is_bigendian should depend on MMU mapping or MSR[LE] |
| 130 | */ |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 131 | /* XXX Should probably auto-generate instruction decoding for a particular core |
| 132 | * from opcode tables in the future. */ |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 133 | int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) |
| 134 | { |
Alexander Graf | c7f38f4 | 2010-04-16 00:11:40 +0200 | [diff] [blame] | 135 | u32 inst = kvmppc_get_last_inst(vcpu); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 136 | u32 ea; |
| 137 | int ra; |
| 138 | int rb; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 139 | int rs; |
| 140 | int rt; |
| 141 | int sprn; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 142 | enum emulation_result emulated = EMULATE_DONE; |
| 143 | int advance = 1; |
| 144 | |
Hollis Blanchard | 73e75b4 | 2008-12-02 15:51:57 -0600 | [diff] [blame] | 145 | /* this default type might be overwritten by subcategories */ |
| 146 | kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS); |
| 147 | |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 148 | pr_debug(KERN_INFO "Emulating opcode %d / %d\n", get_op(inst), get_xop(inst)); |
| 149 | |
Alexander Graf | b4433a7 | 2010-01-08 02:58:04 +0100 | [diff] [blame] | 150 | /* Try again next time */ |
| 151 | if (inst == KVM_INST_FETCH_FAILED) |
| 152 | return EMULATE_DONE; |
| 153 | |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 154 | switch (get_op(inst)) { |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 155 | case OP_TRAP: |
Alexander Graf | 00c3a37 | 2010-04-16 00:11:42 +0200 | [diff] [blame^] | 156 | #ifdef CONFIG_PPC_BOOK3S |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 157 | case OP_TRAP_64: |
Alexander Graf | 25a8a02 | 2010-01-08 02:58:07 +0100 | [diff] [blame] | 158 | kvmppc_core_queue_program(vcpu, SRR1_PROGTRAP); |
Liu Yu | daf5e27 | 2010-02-02 19:44:35 +0800 | [diff] [blame] | 159 | #else |
| 160 | kvmppc_core_queue_program(vcpu, vcpu->arch.esr | ESR_PTR); |
| 161 | #endif |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 162 | advance = 0; |
| 163 | break; |
| 164 | |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 165 | case 31: |
| 166 | switch (get_xop(inst)) { |
| 167 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 168 | case OP_31_XOP_LWZX: |
Hollis Blanchard | ac3cd34 | 2008-05-21 18:22:52 -0500 | [diff] [blame] | 169 | rt = get_rt(inst); |
| 170 | emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1); |
| 171 | break; |
| 172 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 173 | case OP_31_XOP_LBZX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 174 | rt = get_rt(inst); |
| 175 | emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1); |
| 176 | break; |
| 177 | |
Alexander Graf | 1c85e73 | 2010-03-24 21:48:27 +0100 | [diff] [blame] | 178 | case OP_31_XOP_LBZUX: |
| 179 | rt = get_rt(inst); |
| 180 | ra = get_ra(inst); |
| 181 | rb = get_rb(inst); |
| 182 | |
| 183 | ea = kvmppc_get_gpr(vcpu, rb); |
| 184 | if (ra) |
| 185 | ea += kvmppc_get_gpr(vcpu, ra); |
| 186 | |
| 187 | emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1); |
| 188 | kvmppc_set_gpr(vcpu, ra, ea); |
| 189 | break; |
| 190 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 191 | case OP_31_XOP_STWX: |
Hollis Blanchard | ac3cd34 | 2008-05-21 18:22:52 -0500 | [diff] [blame] | 192 | rs = get_rs(inst); |
| 193 | emulated = kvmppc_handle_store(run, vcpu, |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 194 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | ac3cd34 | 2008-05-21 18:22:52 -0500 | [diff] [blame] | 195 | 4, 1); |
| 196 | break; |
| 197 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 198 | case OP_31_XOP_STBX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 199 | rs = get_rs(inst); |
| 200 | emulated = kvmppc_handle_store(run, vcpu, |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 201 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 202 | 1, 1); |
| 203 | break; |
| 204 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 205 | case OP_31_XOP_STBUX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 206 | rs = get_rs(inst); |
| 207 | ra = get_ra(inst); |
| 208 | rb = get_rb(inst); |
| 209 | |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 210 | ea = kvmppc_get_gpr(vcpu, rb); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 211 | if (ra) |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 212 | ea += kvmppc_get_gpr(vcpu, ra); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 213 | |
| 214 | emulated = kvmppc_handle_store(run, vcpu, |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 215 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 216 | 1, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 217 | kvmppc_set_gpr(vcpu, rs, ea); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 218 | break; |
| 219 | |
Alexander Graf | 1c85e73 | 2010-03-24 21:48:27 +0100 | [diff] [blame] | 220 | case OP_31_XOP_LHAX: |
| 221 | rt = get_rt(inst); |
| 222 | emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1); |
| 223 | break; |
| 224 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 225 | case OP_31_XOP_LHZX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 226 | rt = get_rt(inst); |
| 227 | emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1); |
| 228 | break; |
| 229 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 230 | case OP_31_XOP_LHZUX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 231 | rt = get_rt(inst); |
| 232 | ra = get_ra(inst); |
| 233 | rb = get_rb(inst); |
| 234 | |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 235 | ea = kvmppc_get_gpr(vcpu, rb); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 236 | if (ra) |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 237 | ea += kvmppc_get_gpr(vcpu, ra); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 238 | |
| 239 | emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 240 | kvmppc_set_gpr(vcpu, ra, ea); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 241 | break; |
| 242 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 243 | case OP_31_XOP_MFSPR: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 244 | sprn = get_sprn(inst); |
| 245 | rt = get_rt(inst); |
| 246 | |
| 247 | switch (sprn) { |
| 248 | case SPRN_SRR0: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 249 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.srr0); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 250 | case SPRN_SRR1: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 251 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.srr1); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 252 | case SPRN_PVR: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 253 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.pvr); break; |
Liu Yu | 06579dd | 2009-06-05 14:54:31 +0800 | [diff] [blame] | 254 | case SPRN_PIR: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 255 | kvmppc_set_gpr(vcpu, rt, vcpu->vcpu_id); break; |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 256 | case SPRN_MSSSR0: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 257 | kvmppc_set_gpr(vcpu, rt, 0); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 258 | |
| 259 | /* Note: mftb and TBRL/TBWL are user-accessible, so |
| 260 | * the guest can always access the real TB anyways. |
| 261 | * In fact, we probably will never see these traps. */ |
| 262 | case SPRN_TBWL: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 263 | kvmppc_set_gpr(vcpu, rt, get_tb() >> 32); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 264 | case SPRN_TBWU: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 265 | kvmppc_set_gpr(vcpu, rt, get_tb()); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 266 | |
| 267 | case SPRN_SPRG0: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 268 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.sprg0); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 269 | case SPRN_SPRG1: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 270 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.sprg1); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 271 | case SPRN_SPRG2: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 272 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.sprg2); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 273 | case SPRN_SPRG3: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 274 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.sprg3); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 275 | /* Note: SPRG4-7 are user-readable, so we don't get |
| 276 | * a trap. */ |
| 277 | |
Alexander Graf | 9a7a9b0 | 2009-10-30 05:47:15 +0000 | [diff] [blame] | 278 | case SPRN_DEC: |
| 279 | { |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 280 | u64 jd = get_tb() - vcpu->arch.dec_jiffies; |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 281 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.dec - jd); |
| 282 | pr_debug(KERN_INFO "mfDEC: %x - %llx = %lx\n", |
| 283 | vcpu->arch.dec, jd, |
| 284 | kvmppc_get_gpr(vcpu, rt)); |
Alexander Graf | 9a7a9b0 | 2009-10-30 05:47:15 +0000 | [diff] [blame] | 285 | break; |
| 286 | } |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 287 | default: |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 288 | emulated = kvmppc_core_emulate_mfspr(vcpu, sprn, rt); |
| 289 | if (emulated == EMULATE_FAIL) { |
| 290 | printk("mfspr: unknown spr %x\n", sprn); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 291 | kvmppc_set_gpr(vcpu, rt, 0); |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 292 | } |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 293 | break; |
| 294 | } |
| 295 | break; |
| 296 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 297 | case OP_31_XOP_STHX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 298 | rs = get_rs(inst); |
| 299 | ra = get_ra(inst); |
| 300 | rb = get_rb(inst); |
| 301 | |
| 302 | emulated = kvmppc_handle_store(run, vcpu, |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 303 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 304 | 2, 1); |
| 305 | break; |
| 306 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 307 | case OP_31_XOP_STHUX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 308 | rs = get_rs(inst); |
| 309 | ra = get_ra(inst); |
| 310 | rb = get_rb(inst); |
| 311 | |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 312 | ea = kvmppc_get_gpr(vcpu, rb); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 313 | if (ra) |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 314 | ea += kvmppc_get_gpr(vcpu, ra); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 315 | |
| 316 | emulated = kvmppc_handle_store(run, vcpu, |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 317 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 318 | 2, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 319 | kvmppc_set_gpr(vcpu, ra, ea); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 320 | break; |
| 321 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 322 | case OP_31_XOP_MTSPR: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 323 | sprn = get_sprn(inst); |
| 324 | rs = get_rs(inst); |
| 325 | switch (sprn) { |
| 326 | case SPRN_SRR0: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 327 | vcpu->arch.srr0 = kvmppc_get_gpr(vcpu, rs); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 328 | case SPRN_SRR1: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 329 | vcpu->arch.srr1 = kvmppc_get_gpr(vcpu, rs); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 330 | |
| 331 | /* XXX We need to context-switch the timebase for |
| 332 | * watchdog and FIT. */ |
| 333 | case SPRN_TBWL: break; |
| 334 | case SPRN_TBWU: break; |
| 335 | |
Alexander Graf | 513579e | 2009-10-30 05:47:16 +0000 | [diff] [blame] | 336 | case SPRN_MSSSR0: break; |
| 337 | |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 338 | case SPRN_DEC: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 339 | vcpu->arch.dec = kvmppc_get_gpr(vcpu, rs); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 340 | kvmppc_emulate_dec(vcpu); |
| 341 | break; |
| 342 | |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 343 | case SPRN_SPRG0: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 344 | vcpu->arch.sprg0 = kvmppc_get_gpr(vcpu, rs); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 345 | case SPRN_SPRG1: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 346 | vcpu->arch.sprg1 = kvmppc_get_gpr(vcpu, rs); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 347 | case SPRN_SPRG2: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 348 | vcpu->arch.sprg2 = kvmppc_get_gpr(vcpu, rs); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 349 | case SPRN_SPRG3: |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 350 | vcpu->arch.sprg3 = kvmppc_get_gpr(vcpu, rs); break; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 351 | |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 352 | default: |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 353 | emulated = kvmppc_core_emulate_mtspr(vcpu, sprn, rs); |
| 354 | if (emulated == EMULATE_FAIL) |
| 355 | printk("mtspr: unknown spr %x\n", sprn); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 356 | break; |
| 357 | } |
| 358 | break; |
| 359 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 360 | case OP_31_XOP_DCBI: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 361 | /* Do nothing. The guest is performing dcbi because |
| 362 | * hardware DMA is not snooped by the dcache, but |
| 363 | * emulated DMA either goes through the dcache as |
| 364 | * normal writes, or the host kernel has handled dcache |
| 365 | * coherence. */ |
| 366 | break; |
| 367 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 368 | case OP_31_XOP_LWBRX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 369 | rt = get_rt(inst); |
| 370 | emulated = kvmppc_handle_load(run, vcpu, rt, 4, 0); |
| 371 | break; |
| 372 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 373 | case OP_31_XOP_TLBSYNC: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 374 | break; |
| 375 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 376 | case OP_31_XOP_STWBRX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 377 | rs = get_rs(inst); |
| 378 | ra = get_ra(inst); |
| 379 | rb = get_rb(inst); |
| 380 | |
| 381 | emulated = kvmppc_handle_store(run, vcpu, |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 382 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 383 | 4, 0); |
| 384 | break; |
| 385 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 386 | case OP_31_XOP_LHBRX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 387 | rt = get_rt(inst); |
| 388 | emulated = kvmppc_handle_load(run, vcpu, rt, 2, 0); |
| 389 | break; |
| 390 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 391 | case OP_31_XOP_STHBRX: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 392 | rs = get_rs(inst); |
| 393 | ra = get_ra(inst); |
| 394 | rb = get_rb(inst); |
| 395 | |
| 396 | emulated = kvmppc_handle_store(run, vcpu, |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 397 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 398 | 2, 0); |
| 399 | break; |
| 400 | |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 401 | default: |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 402 | /* Attempt core-specific emulation below. */ |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 403 | emulated = EMULATE_FAIL; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 404 | } |
| 405 | break; |
| 406 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 407 | case OP_LWZ: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 408 | rt = get_rt(inst); |
| 409 | emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1); |
| 410 | break; |
| 411 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 412 | case OP_LWZU: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 413 | ra = get_ra(inst); |
| 414 | rt = get_rt(inst); |
| 415 | emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 416 | kvmppc_set_gpr(vcpu, ra, vcpu->arch.paddr_accessed); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 417 | break; |
| 418 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 419 | case OP_LBZ: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 420 | rt = get_rt(inst); |
| 421 | emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1); |
| 422 | break; |
| 423 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 424 | case OP_LBZU: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 425 | ra = get_ra(inst); |
| 426 | rt = get_rt(inst); |
| 427 | emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 428 | kvmppc_set_gpr(vcpu, ra, vcpu->arch.paddr_accessed); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 429 | break; |
| 430 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 431 | case OP_STW: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 432 | rs = get_rs(inst); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 433 | emulated = kvmppc_handle_store(run, vcpu, |
| 434 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 435 | 4, 1); |
| 436 | break; |
| 437 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 438 | case OP_STWU: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 439 | ra = get_ra(inst); |
| 440 | rs = get_rs(inst); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 441 | emulated = kvmppc_handle_store(run, vcpu, |
| 442 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 443 | 4, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 444 | kvmppc_set_gpr(vcpu, ra, vcpu->arch.paddr_accessed); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 445 | break; |
| 446 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 447 | case OP_STB: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 448 | rs = get_rs(inst); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 449 | emulated = kvmppc_handle_store(run, vcpu, |
| 450 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 451 | 1, 1); |
| 452 | break; |
| 453 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 454 | case OP_STBU: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 455 | ra = get_ra(inst); |
| 456 | rs = get_rs(inst); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 457 | emulated = kvmppc_handle_store(run, vcpu, |
| 458 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 459 | 1, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 460 | kvmppc_set_gpr(vcpu, ra, vcpu->arch.paddr_accessed); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 461 | break; |
| 462 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 463 | case OP_LHZ: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 464 | rt = get_rt(inst); |
| 465 | emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1); |
| 466 | break; |
| 467 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 468 | case OP_LHZU: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 469 | ra = get_ra(inst); |
| 470 | rt = get_rt(inst); |
| 471 | emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 472 | kvmppc_set_gpr(vcpu, ra, vcpu->arch.paddr_accessed); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 473 | break; |
| 474 | |
Alexander Graf | 3587d53 | 2010-02-19 11:00:30 +0100 | [diff] [blame] | 475 | case OP_LHA: |
| 476 | rt = get_rt(inst); |
| 477 | emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1); |
| 478 | break; |
| 479 | |
| 480 | case OP_LHAU: |
| 481 | ra = get_ra(inst); |
| 482 | rt = get_rt(inst); |
| 483 | emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1); |
| 484 | kvmppc_set_gpr(vcpu, ra, vcpu->arch.paddr_accessed); |
| 485 | break; |
| 486 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 487 | case OP_STH: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 488 | rs = get_rs(inst); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 489 | emulated = kvmppc_handle_store(run, vcpu, |
| 490 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 491 | 2, 1); |
| 492 | break; |
| 493 | |
Hollis Blanchard | cea5d8c | 2009-01-03 16:23:05 -0600 | [diff] [blame] | 494 | case OP_STHU: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 495 | ra = get_ra(inst); |
| 496 | rs = get_rs(inst); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 497 | emulated = kvmppc_handle_store(run, vcpu, |
| 498 | kvmppc_get_gpr(vcpu, rs), |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 499 | 2, 1); |
Alexander Graf | 8e5b26b | 2010-01-08 02:58:01 +0100 | [diff] [blame] | 500 | kvmppc_set_gpr(vcpu, ra, vcpu->arch.paddr_accessed); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 501 | break; |
| 502 | |
| 503 | default: |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 504 | emulated = EMULATE_FAIL; |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 505 | } |
| 506 | |
| 507 | if (emulated == EMULATE_FAIL) { |
| 508 | emulated = kvmppc_core_emulate_op(run, vcpu, inst, &advance); |
Alexander Graf | 37f5bca | 2010-02-19 11:00:31 +0100 | [diff] [blame] | 509 | if (emulated == EMULATE_AGAIN) { |
| 510 | advance = 0; |
| 511 | } else if (emulated == EMULATE_FAIL) { |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 512 | advance = 0; |
| 513 | printk(KERN_ERR "Couldn't emulate instruction 0x%08x " |
| 514 | "(op %d xop %d)\n", inst, get_op(inst), get_xop(inst)); |
Alexander Graf | 5f2b105 | 2010-01-10 03:27:32 +0100 | [diff] [blame] | 515 | kvmppc_core_queue_program(vcpu, 0); |
Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 516 | } |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 517 | } |
| 518 | |
Alexander Graf | c7f38f4 | 2010-04-16 00:11:40 +0200 | [diff] [blame] | 519 | trace_kvm_ppc_instr(inst, kvmppc_get_pc(vcpu), emulated); |
Christian Ehrhardt | 3b4bd79 | 2008-07-14 14:00:04 +0200 | [diff] [blame] | 520 | |
Alexander Graf | c7f38f4 | 2010-04-16 00:11:40 +0200 | [diff] [blame] | 521 | /* Advance past emulated instruction. */ |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 522 | if (advance) |
Alexander Graf | c7f38f4 | 2010-04-16 00:11:40 +0200 | [diff] [blame] | 523 | kvmppc_set_pc(vcpu, kvmppc_get_pc(vcpu) + 4); |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 524 | |
| 525 | return emulated; |
| 526 | } |