Author: kib
Date: Sat Mar 16 11:12:02 2019
New Revision: 345225
URL: https://svnweb.freebsd.org/changeset/base/345225

Log:
  amd64: rewrite cpu_switch.S fragment to reload tss.rsp0 on context switch.
  
  New code avoids jumps.
  
  Reviewed by:  markj
  Tested by:    pho
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week
  Differential revision:        https://reviews.freebsd.org/D19514

Modified:
  head/sys/amd64/amd64/cpu_switch.S

Modified: head/sys/amd64/amd64/cpu_switch.S
==============================================================================
--- head/sys/amd64/amd64/cpu_switch.S   Sat Mar 16 10:51:11 2019        
(r345224)
+++ head/sys/amd64/amd64/cpu_switch.S   Sat Mar 16 11:12:02 2019        
(r345225)
@@ -209,14 +209,11 @@ do_kthread:
 done_tss:
        movq    %r8,PCPU(RSP0)
        movq    %r8,PCPU(CURPCB)
-       /* Update the TSS_RSP0 pointer for the next interrupt */
-       cmpq    $~0,PCPU(UCR3)
-       je      1f
        movq    PCPU(PTI_RSP0),%rax
+       cmpq    $~0,PCPU(UCR3)
+       cmove   %r8,%rax
        movq    %rax,TSS_RSP0(%rdx)
-       jmp     2f
-1:     movq    %r8,TSS_RSP0(%rdx)
-2:     movq    %r12,PCPU(CURTHREAD)            /* into next thread */
+       movq    %r12,PCPU(CURTHREAD)            /* into next thread */
 
        /* Test if debug registers should be restored. */
        testl   $PCB_DBREGS,PCB_FLAGS(%r8)
_______________________________________________
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