Author: sginsberg
Date: Sat Aug 30 17:54:27 2008
New Revision: 35821
URL:
http://svn.reactos.org/svn/reactos?rev=35821&view=rev
Log:
- Add SecureZeroMemory/RtlSecureZeroMemory
- Add x86 versions of PreFetchCacheLine and MemoryBarrier (TODO for other architectures)
Modified:
trunk/reactos/include/psdk/winbase.h
trunk/reactos/include/psdk/winnt.h
Modified: trunk/reactos/include/psdk/winbase.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winbase.h?rev…
==============================================================================
--- trunk/reactos/include/psdk/winbase.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winbase.h [iso-8859-1] Sat Aug 30 17:54:27 2008
@@ -1208,6 +1208,7 @@
#define CopyMemory RtlCopyMemory
#define FillMemory RtlFillMemory
#define ZeroMemory RtlZeroMemory
+#define SecureZeroMemory RtlSecureZeroMemory
BOOL WINAPI CopySid(DWORD,PSID,PSID);
#if (_WIN32_WINNT >= 0x0501)
HANDLE WINAPI CreateActCtxA(PCACTCTXA);
Modified: trunk/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=3…
==============================================================================
--- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Sat Aug 30 17:54:27 2008
@@ -4453,6 +4453,23 @@
#define RtlFillMemory(d,l,f) memset((d), (f), (l))
#define RtlZeroMemory(d,l) RtlFillMemory((d),(l),0)
+FORCEINLINE
+PVOID
+RtlSecureZeroMemory(IN PVOID ptr,
+ IN SIZE_T cnt)
+{
+ volatile char *vptr = (volatile char *)ptr;
+
+ while (cnt)
+ {
+ *vptr = 0;
+ vptr++;
+ cnt--;
+ }
+
+ return ptr;
+}
+
typedef struct _OBJECT_TYPE_LIST {
WORD Level;
WORD Sbz;
@@ -4656,6 +4673,43 @@
#endif
+/* TODO: Other architectures than X86 */
+#if defined(_M_IX86)
+#define PF_TEMPORAL_LEVEL_1
+#define PF_NON_TEMPORAL_LEVEL_ALL
+#define PreFetchCacheLine(l, a)
+#elif defined (_M_AMD64)
+#define PreFetchCacheLine(l, a)
+#elif defined(_M_PPC)
+#define PreFetchCacheLine(l, a)
+#elif defined(_M_ARM)
+#define PreFetchCacheLine(l, a)
+#else
+#error Unknown architecture
+#endif
+
+/* TODO: Other architectures than X86 */
+#if defined(_M_IX86)
+FORCEINLINE
+VOID
+MemoryBarrier(VOID)
+{
+ LONG Barrier;
+ __asm__ __volatile__
+ {
+ xchg Barrier, eax
+ }
+}
+#elif defined (_M_AMD64)
+#define MemoryBarrier()
+#elif defined(_M_PPC)
+#define MemoryBarrier()
+#elif defined(_M_ARM)
+#define MemoryBarrier()
+#else
+#error Unknown architecture
+#endif
+
#if defined(_M_IX86)
#define YieldProcessor() __asm__ __volatile__("pause");
#elif defined (_M_AMD64)