Author: royger
Date: Sat Jan 20 14:59:37 2018
New Revision: 328199
URL: https://svnweb.freebsd.org/changeset/base/328199

Log:
  xen: fix IDT setup after PTI
  
  On amd64 the IDT handler was not set correctly when using PTI.
  
  While there also fix the selectors to SEL_KPL.
  
  Obtained from:        kib
  MFC with:     r328083

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/i386/i386/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c      Sat Jan 20 14:47:27 2018        
(r328198)
+++ head/sys/amd64/amd64/machdep.c      Sat Jan 20 14:59:37 2018        
(r328199)
@@ -1667,7 +1667,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
            &IDTVEC(dtrace_ret), SDT_SYSIGT, SEL_UPL, 0);
 #endif
 #ifdef XENHVM
-       setidt(IDT_EVTCHN, &IDTVEC(xen_intr_upcall), SDT_SYSIGT, SEL_UPL, 0);
+       setidt(IDT_EVTCHN, pti ? &IDTVEC(xen_intr_upcall_pti) :
+           &IDTVEC(xen_intr_upcall), SDT_SYSIGT, SEL_KPL, 0);
 #endif
        r_idt.rd_limit = sizeof(idt0) - 1;
        r_idt.rd_base = (long) idt;

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c        Sat Jan 20 14:47:27 2018        
(r328198)
+++ head/sys/i386/i386/machdep.c        Sat Jan 20 14:59:37 2018        
(r328199)
@@ -2268,7 +2268,7 @@ init386(int first)
            GSEL(GCODE_SEL, SEL_KPL));
 #endif
 #ifdef XENHVM
-       setidt(IDT_EVTCHN, &IDTVEC(xen_intr_upcall), SDT_SYS386IGT, SEL_UPL,
+       setidt(IDT_EVTCHN, &IDTVEC(xen_intr_upcall), SDT_SYS386IGT, SEL_KPL,
            GSEL(GCODE_SEL, SEL_KPL));
 #endif
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to