summaryrefslogtreecommitdiffhomepage
path: root/src/string
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-06-28 01:33:27 +0000
committermidipix <writeonce@midipix.org>2019-06-28 01:33:27 +0000
commit6445d5ff7e35e9ed6e54ce420931ad9676be5e7d (patch)
tree75910eb0ddb77487e5163de10e700f5b57519658 /src/string
parent4686dff16bcfb6071e4aa43d2cec0752c0d15bd5 (diff)
downloadntapi-6445d5ff7e35e9ed6e54ce420931ad9676be5e7d.tar.bz2
ntapi-6445d5ff7e35e9ed6e54ce420931ad9676be5e7d.tar.xz
remove nt_sync_block and related interfaces in favor of pure atomic primitives.
Diffstat (limited to 'src/string')
-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;