svn commit: r340682 - stable/12/sys/amd64/include
Mateusz Guzik
mjg at FreeBSD.org
Tue Nov 20 17:01:57 UTC 2018
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())
More information about the svn-src-stable
mailing list