[ros-diffs] [sir_richard] 45210: [PERF]: Do not declare the PCR in KeGetPcr as volatile. It is only volatile as in "if there is a context switch, the PCR is different". You are in a LOT of trouble if the thread switches while your code is running in the first place, and your code is somehow running as a different thread! This change makes C code a lot neater, especially during PCR access, because it doesn't force reloading the PCR each time. For example, Read-Modify-Operations on the PCR, such as AND are 1 line of assembly instead of 3. This helps and will help further with the C HAL, as well as the C trap handlers.

sir_richard at svn.reactos.org sir_richard at svn.reactos.org
Sat Jan 23 19:28:14 CET 2010


Author: sir_richard
Date: Sat Jan 23 19:28:14 2010
New Revision: 45210

URL: http://svn.reactos.org/svn/reactos?rev=45210&view=rev
Log:
[PERF]: Do not declare the PCR in KeGetPcr as volatile. It is only volatile as in "if there is a context switch, the PCR is different". You are in a LOT of trouble if the thread switches while your code is running in the first place, and your code is somehow running as a different thread!
This change makes C code a lot neater, especially during PCR access, because it doesn't force reloading the PCR each time. For example, Read-Modify-Operations on the PCR, such as AND are 1 line of assembly instead of 3.
This helps and will help further with the C HAL, as well as the C trap handlers.

Modified:
    trunk/reactos/include/ndk/i386/ketypes.h

Modified: trunk/reactos/include/ndk/i386/ketypes.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/i386/ketypes.h?rev=45210&r1=45209&r2=45210&view=diff
==============================================================================
--- trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] Sat Jan 23 19:28:14 2010
@@ -27,10 +27,10 @@
 // KPCR Access for non-IA64 builds
 //
 #define K0IPCR                  ((ULONG_PTR)(KIP0PCRADDRESS))
-#define PCR                     ((volatile KPCR * const)K0IPCR)
+#define PCR                     ((KPCR * const)K0IPCR)
 #if defined(CONFIG_SMP) || defined(NT_BUILD)
 #undef  KeGetPcr
-#define KeGetPcr()              ((volatile KPCR * const)__readfsdword(0x1C))
+#define KeGetPcr()              ((KPCR * const)__readfsdword(FIELD_OFFSET(KPCR, Self)))
 #endif
 
 //




More information about the Ros-diffs mailing list