This issue observed on ARM, when doing to map kernel allocated memory
i.e via __get_free_pages.
Kernel module updating some counters are not immediately reflected
to userspace code.
The following code in the userspace program is used to clear the
cache after read operation.
/* community.arm.com */
void clear_arm_cache(const char *start_addr , const char *end_addr)
{
const int syscall = 0xf0002;
__asm __volatile (
"mov r0, %0\n"
"mov r1, %1\n"
"mov r7, %2\n"
"mov r2, #0x0\n"
"svc 0x00000000\n"
:
: "r" (begin), "r" (end), "r" (syscall)
: "r0", "r1", "r7"
);
}
No comments:
Post a Comment