MAKE_INSTR(HLT, 1, 0xf4);
MAKE_INSTR(INT3, 1, 0xcc);
MAKE_INSTR(RDTSC, 2, 0x0f, 0x31);
+MAKE_INSTR(PAUSE, 1, 0x90);
static const u8 *opc_bytes[INSTR_MAX_COUNT] =
{
[INSTR_VMCALL] = OPCODE_VMCALL,
[INSTR_HLT] = OPCODE_HLT,
[INSTR_INT3] = OPCODE_INT3,
- [INSTR_RDTSC] = OPCODE_RDTSC
+ [INSTR_RDTSC] = OPCODE_RDTSC,
+ [INSTR_PAUSE] = OPCODE_PAUSE,
};
static int fetch(struct vcpu *v, u8 *buf, unsigned long addr, int len)
hvm_rdtsc_intercept(regs);
}
+static void svm_vmexit_do_pause(struct cpu_user_regs *regs)
+{
+ unsigned int inst_len;
+
+ if ( (inst_len = __get_instruction_length(current, INSTR_PAUSE)) == 0 )
+ return;
+ __update_guest_eip(regs, inst_len);
+
+ /*
+ * The guest is running a contended spinlock and we've detected it.
+ * Do something useful, like reschedule the guest
+ */
+ perfc_incr(pauseloop_exits);
+ do_sched_op_compat(SCHEDOP_yield, 0);
+}
+
static void svm_vmexit_ud_intercept(struct cpu_user_regs *regs)
{
struct hvm_emulate_ctxt ctxt;
break;
case VMEXIT_PAUSE:
- /*
- * The guest is running a contended spinlock and we've detected it.
- * Do something useful, like reschedule the guest
- */
- perfc_incr(pauseloop_exits);
- do_sched_op_compat(SCHEDOP_yield, 0);
+ svm_vmexit_do_pause(regs);
break;
default: