@@ -1862,6 +1862,26 @@ void emulate_gate_op(struct cpu_user_regs *regs)
instruction_done(regs, off);
}
+int emulate_invalid_rdtscp(struct cpu_user_regs *regs)
+{
+ char opcode[3];
+ unsigned long eip, rc;
+ struct vcpu *v = current;
+
+ eip = regs->rip;
+ if ( (rc = copy_from_user(opcode, (char *)eip, sizeof(opcode))) != 0 )
+ {
+ pv_inject_page_fault(0, eip + sizeof(opcode) - rc);
+ return EXCRET_fault_fixed;
+ }
+ if ( memcmp(opcode, "\xf\x1\xf9", sizeof(opcode)) )
+ return 0;
+ eip += sizeof(opcode);
+ pv_soft_rdtsc(v, regs, 1);
+ instruction_done(regs, eip);
+ return EXCRET_fault_fixed;
+}
+
/*
* Local variables:
* mode: C
@@ -978,26 +978,6 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
}
}
-static int emulate_invalid_rdtscp(struct cpu_user_regs *regs)
-{
- char opcode[3];
- unsigned long eip, rc;
- struct vcpu *v = current;
-
- eip = regs->rip;
- if ( (rc = copy_from_user(opcode, (char *)eip, sizeof(opcode))) != 0 )
- {
- pv_inject_page_fault(0, eip + sizeof(opcode) - rc);
- return EXCRET_fault_fixed;
- }
- if ( memcmp(opcode, "\xf\x1\xf9", sizeof(opcode)) )
- return 0;
- eip += sizeof(opcode);
- pv_soft_rdtsc(v, regs, 1);
- instruction_done(regs, eip);
- return EXCRET_fault_fixed;
-}
-
static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
{
char sig[5], instr[2];
@@ -27,6 +27,7 @@
int emulate_privileged_op(struct cpu_user_regs *regs);
void emulate_gate_op(struct cpu_user_regs *regs);
+int emulate_invalid_rdtscp(struct cpu_user_regs *regs);
#else /* !CONFIG_PV */
@@ -34,6 +35,7 @@ void emulate_gate_op(struct cpu_user_regs *regs);
int emulate_privileged_op(struct cpu_user_regs *regs) { return -EOPNOTSUPP; }
void emulate_gate_op(struct cpu_user_regs *regs) {}
+int emulate_invalid_rdtscp(struct cpu_user_regs *regs) { return 0; }
#endif /* CONFIG_PV */
And export it in pv/traps.h. The stub function returns 0 because that represents "unsuccessful emulation" in the original code. No functional change. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- xen/arch/x86/pv/emulate.c | 20 ++++++++++++++++++++ xen/arch/x86/traps.c | 20 -------------------- xen/include/asm-x86/pv/traps.h | 2 ++ 3 files changed, 22 insertions(+), 20 deletions(-)