94084c
commit 8d1927d8dc5aad0f01c929123086be3a5b799d18
94084c
Author: Florian Weimer <fweimer@redhat.com>
94084c
Date:   Thu Dec 9 09:49:32 2021 +0100
94084c
94084c
    nptl: Introduce THREAD_GETMEM_VOLATILE
94084c
    
94084c
    This will be needed for rseq TCB access.
94084c
    
94084c
    Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
94084c
94084c
diff --git a/sysdeps/i386/nptl/tcb-access.h b/sysdeps/i386/nptl/tcb-access.h
94084c
index 6c6d561e394817c7..5ddd83224bc8eb77 100644
94084c
--- a/sysdeps/i386/nptl/tcb-access.h
94084c
+++ b/sysdeps/i386/nptl/tcb-access.h
94084c
@@ -41,6 +41,8 @@
94084c
        }								      \
94084c
      __value; })
94084c
 
94084c
+/* THREAD_GETMEM already forces a read.  */
94084c
+#define THREAD_GETMEM_VOLATILE(descr, member) THREAD_GETMEM (descr, member)
94084c
 
94084c
 /* Same as THREAD_GETMEM, but the member offset can be non-constant.  */
94084c
 #define THREAD_GETMEM_NC(descr, member, idx) \
94084c
diff --git a/sysdeps/nptl/tcb-access.h b/sysdeps/nptl/tcb-access.h
94084c
index b4137b8ab8067915..bbe20b7225b060fd 100644
94084c
--- a/sysdeps/nptl/tcb-access.h
94084c
+++ b/sysdeps/nptl/tcb-access.h
94084c
@@ -22,6 +22,8 @@
94084c
 
94084c
 #define THREAD_GETMEM(descr, member) \
94084c
   descr->member
94084c
+#define THREAD_GETMEM_VOLATILE(descr, member) \
94084c
+  (*(volatile __typeof (descr->member) *)&descr->member)
94084c
 #define THREAD_GETMEM_NC(descr, member, idx) \
94084c
   descr->member[idx]
94084c
 #define THREAD_SETMEM(descr, member, value) \
94084c
diff --git a/sysdeps/x86_64/nptl/tcb-access.h b/sysdeps/x86_64/nptl/tcb-access.h
94084c
index 18848a729d16a4f5..e4d2d07a9b218025 100644
94084c
--- a/sysdeps/x86_64/nptl/tcb-access.h
94084c
+++ b/sysdeps/x86_64/nptl/tcb-access.h
94084c
@@ -39,6 +39,8 @@
94084c
        }								      \
94084c
      __value; })
94084c
 
94084c
+/* THREAD_GETMEM already forces a read.  */
94084c
+#define THREAD_GETMEM_VOLATILE(descr, member) THREAD_GETMEM (descr, member)
94084c
 
94084c
 /* Same as THREAD_GETMEM, but the member offset can be non-constant.  */
94084c
 # define THREAD_GETMEM_NC(descr, member, idx) \