summaryrefslogtreecommitdiffhomepage
path: root/src/string/ntapi_tt_aligned_block_memlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string/ntapi_tt_aligned_block_memlock.c')
-rw-r--r--src/string/ntapi_tt_aligned_block_memlock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/string/ntapi_tt_aligned_block_memlock.c b/src/string/ntapi_tt_aligned_block_memlock.c
index 17fb078..3177759 100644
--- a/src/string/ntapi_tt_aligned_block_memlock.c
+++ b/src/string/ntapi_tt_aligned_block_memlock.c
@@ -9,15 +9,17 @@
#include <ntapi/nt_sync.h>
#include <ntapi/nt_atomic.h>
+#define __CPU_CACHE_SIZE 64
+
__attr_protected__
uintptr_t * __cdecl __ntapi_tt_aligned_block_memlock(
__in uintptr_t * dst,
__in size_t bytes)
{
- size_t addr = (size_t)dst & ~(size_t)(NT_SYNC_BLOCK_SIZE);
+ size_t addr = (size_t)dst & ~(size_t)(__CPU_CACHE_SIZE);
size_t cap = addr + bytes;
- for (; addr<cap; addr+=NT_SYNC_BLOCK_SIZE)
+ for (; addr<cap; addr+=__CPU_CACHE_SIZE)
at_locked_xadd((intptr_t *)addr,0);
return dst;