microsoft/graphics-driver-samples

KeInvalidateAllCaches() alternative for ARM64

tester962 opened this issue · 6 comments

The driver can't be compiled on ARM64 because of the missing KeInvalidateAllCaches().
Can someone provide an alternative using KeInvalidateRangeAllCaches() ?

File: RosKmdRapAdapter.cpp, line 445

According to this: https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntddk/nf-ntddk-keinvalidateallcaches, KeInvalidateAllCaches() is availbe universally on all platforms

But VS refuses to build that when set to ARM64 and complains about KeInvalidateAllCaches.

Yeah, I know. I'm not sure why it does that. It happens even if you include ntddk.h

It seems this thing cannot be used in WoA ARM64. I opened ntoskrnl.exe using IDA and searched for it but found nothing. While the x64 one does have this.

pmsjt commented

Arm arch itself does not provide a way to clean and/or invalidate the entire d-cache. This means that d-cache clean operations always need a start address and length. That is the reason a parameter-less KeInvalidateAllCaches cannot be implemented reliably.

_IRQL_requires_min_(PASSIVE_LEVEL)
_IRQL_requires_max_(DISPATCH_LEVEL)
NTKERNELAPI
VOID
FASTCALL
KeInvalidateRangeAllCaches (
    _In_ PVOID BaseAddress,
    _In_ ULONG Length
    );

Is the replacement and it is available on all architectures. For some reason, I can't find it in the documentation. Will try to investigate why.