Skip to content

Instantly share code, notes, and snippets.

@JustasMasiulis
Last active April 4, 2019 12:26
Show Gist options
  • Save JustasMasiulis/aed906ea3fcf6a864bb4afc49327b5b0 to your computer and use it in GitHub Desktop.
Save JustasMasiulis/aed906ea3fcf6a864bb4afc49327b5b0 to your computer and use it in GitHub Desktop.
MI_PFN_CACHE_ATTRIBUTE MiProtectionToCacheAttribute(uint32_t protection) {
if(protection != 0x1F) // all flags combined
{
if(protection >> 3 == 3) // MM_WRITECOMBINE
{
if(protection & 7) // check if it has any actual access
return MiWriteCombined;
}
else if (protection >> 3 == 1) // MM_NOCACHE
return MiNonCached;
}
return MiCached;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment