androidandroid-ndkarm64clear-cache

How to call clear cache on Android Native ARM64?


Simple question for simple answer.

I just can't figure out how to clear the instruction cache properly on such architecture.

Did anyone use it?


Solution

  • GCC provide this built-in function

    __builtin___clear_cache (void* start, void* end)
    

    that is automatically managed according to the architecture.

    Parameters set the range of memory to cache, where start is inclusive and end is exclusive. Every time a new memory area with instructions to execute, the cache should be cleared for that area.

    reading