About MemoryBarrier #2092
Replies: 2 comments 4 replies
-
Some processors execute code out-of-order and with an incorrect sequence. MemoryBarrier guarantees the order of execution as written and returns the correct value for count which is required in this case because the function is used for memory management and an incorrect value would leak memory - Most compilers insert fences automatically during compile time but sometimes an explicit reference is needed to guarantee the correct placement. See the examples section of the wiki: |
Beta Was this translation helpful? Give feedback.
-
The project has Github Copilot and for fun I asked it to explain the function: |
Beta Was this translation helpful? Give feedback.
-
What is the purpose of MemoryBarrier in this context:
IRQL_requires_max(APC_LEVEL)
LONG KphGetDriverUnloadProtectionCount(
VOID
)
{
LONG count;
}
Beta Was this translation helpful? Give feedback.
All reactions