Advertisement
jintack

Xen trap-in patch 3 : cr0, eax

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