svn commit: r327403 - stable/11/sys/amd64/amd64

Mateusz Guzik mjg at FreeBSD.org
Sun Dec 31 02:48:17 UTC 2017


Author: mjg
Date: Sun Dec 31 02:48:16 2017
New Revision: 327403
URL: https://svnweb.freebsd.org/changeset/base/327403

Log:
  MFC r321922:
      amd64: annotate the syscall return address check with __predict_false
  
      before:
         0xffffffff80b03ebb <+2059>:      mov    0x460(%r14),%rax
         0xffffffff80b03ec2 <+2066>:      mov    0x98(%rax),%rax
         0xffffffff80b03ec9 <+2073>:      shr    $0x2f,%rax
         0xffffffff80b03ecd <+2077>:      je     0xffffffff80b03edd <amd64_syscall+2093>
         0xffffffff80b03ecf <+2079>:      mov    0x3f8(%r14),%rax
         0xffffffff80b03ed6 <+2086>:      orl    $0x1,0xc8(%rax)
         0xffffffff80b03edd <+2093>:      add    $0xf8,%rsp
  
      after:
         0xffffffff80b03ebb <+2059>:      mov    0x460(%r14),%rax
         0xffffffff80b03ec2 <+2066>:      mov    0x98(%rax),%rax
         0xffffffff80b03ec9 <+2073>:      shr    $0x2f,%rax
         0xffffffff80b03ecd <+2077>:      jne    0xffffffff80b03eef <amd64_syscall+2111>
         0xffffffff80b03ecf <+2079>:      add    $0xf8,%rsp

Modified:
  stable/11/sys/amd64/amd64/trap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/trap.c
==============================================================================
--- stable/11/sys/amd64/amd64/trap.c	Sun Dec 31 02:31:01 2017	(r327402)
+++ stable/11/sys/amd64/amd64/trap.c	Sun Dec 31 02:48:16 2017	(r327403)
@@ -947,6 +947,6 @@ amd64_syscall(struct thread *td, int traced)
 	 * not be safe.  Instead, use the full return path which
 	 * catches the problem safely.
 	 */
-	if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS)
+	if (__predict_false(td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS))
 		set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
 }


More information about the svn-src-stable mailing list