Author: royger
Date: Tue Jun 26 14:39:27 2018
New Revision: 335666
URL: https://svnweb.freebsd.org/changeset/base/335666

Log:
  xen: limit the number of hypercall pages to 1
  
  The interface already guarantees that the number of hypercall pages is
  always going to be 1, see the comment in interface/arch-x86/cpuid.h
  
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/x86/xen/hvm.c

Modified: head/sys/x86/xen/hvm.c
==============================================================================
--- head/sys/x86/xen/hvm.c      Tue Jun 26 14:30:33 2018        (r335665)
+++ head/sys/x86/xen/hvm.c      Tue Jun 26 14:39:27 2018        (r335666)
@@ -124,7 +124,6 @@ static int
 xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
 {
        uint32_t base, regs[4];
-       int i;
 
        if (xen_pv_domain()) {
                /* hypercall page is already set in the PV case */
@@ -167,9 +166,10 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type in
         * Find the hypercall pages.
         */
        do_cpuid(base + 2, regs);
+       if (regs[0] != 1)
+               return (EINVAL);
 
-       for (i = 0; i < regs[0]; i++)
-               wrmsr(regs[1], vtophys(&hypercall_page + i * PAGE_SIZE) + i);
+       wrmsr(regs[1], vtophys(&hypercall_page));
 
        return (0);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to