Advertisement
jintack

Xen trap-in patch 2

Mar 20th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
  2. index 664ed83..f577c60 100644
  3. --- a/xen/arch/x86/hvm/vmx/entry.S
  4. +++ b/xen/arch/x86/hvm/vmx/entry.S
  5. @@ -30,6 +30,13 @@
  6. #define VMLAUNCH .byte 0x0f,0x01,0xc2
  7.  
  8. ENTRY(vmx_asm_vmexit_handler)
  9. + cmp $0x4b000000, %rax
  10. + jne .Lnormal
  11. + mov $0x7777, %rcx
  12. + RDTSC
  13. + shl $0x20, %rdx
  14. + or %rax, %rdx
  15. +.Lnormal:
  16. push %rdi
  17. push %rsi
  18. push %rdx
  19. diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
  20. index f2554d6..09c7f57 100644
  21. --- a/xen/arch/x86/hvm/vmx/vmx.c
  22. +++ b/xen/arch/x86/hvm/vmx/vmx.c
  23. @@ -2953,9 +2953,16 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
  24. break;
  25. case EXIT_REASON_VMCALL:
  26. {
  27. - int rc;
  28. - HVMTRACE_1D(VMMCALL, regs->eax);
  29. - rc = hvm_do_hypercall(regs);
  30. + int rc;
  31. + HVMTRACE_1D(VMMCALL, regs->eax);
  32. + if (regs->rcx == 0x7777)
  33. + {
  34. + regs->rdx = hvm_get_guest_tsc_fixed(v, regs->rdx);
  35. + rc = HVM_HCALL_completed;
  36. + goto skip_vmcall;
  37. + }
  38. + rc = hvm_do_hypercall(regs);
  39. +skip_vmcall:
  40. if ( rc != HVM_HCALL_preempted )
  41. {
  42. update_guest_eip(); /* Safe: VMCALL */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement