Date: Tue, 20 Nov 2018 17:01:56 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340682 - stable/12/sys/amd64/include Message-ID: <201811201701.wAKH1uBG096846@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Tue Nov 20 17:01:55 2018 New Revision: 340682 URL: https://svnweb.freebsd.org/changeset/base/340682 Log: MFC r339449: amd64: relax constraints in curthread and curpcb This makes the compiler less likely to reload the content from %gs. The 'P' modifier drops all synteax prefixes and 'n' constraint treats input as a known at compilation time immediate integer. Example reloading victim was spinlock_enter. Modified: stable/12/sys/amd64/include/pcpu.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/include/pcpu.h ============================================================================== --- stable/12/sys/amd64/include/pcpu.h Tue Nov 20 16:54:42 2018 (r340681) +++ stable/12/sys/amd64/include/pcpu.h Tue Nov 20 17:01:55 2018 (r340682) @@ -227,8 +227,7 @@ __curthread(void) { struct thread *td; - __asm("movq %%gs:%1,%0" : "=r" (td) - : "m" (*(char *)OFFSETOF_CURTHREAD)); + __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (OFFSETOF_CURTHREAD)); return (td); } #ifdef __clang__ @@ -242,7 +241,7 @@ __curpcb(void) { struct pcb *pcb; - __asm("movq %%gs:%1,%0" : "=r" (pcb) : "m" (*(char *)OFFSETOF_CURPCB)); + __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (OFFSETOF_CURPCB)); return (pcb); } #define curpcb (__curpcb())
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811201701.wAKH1uBG096846>