I am using cortex A8 in user mode and trying to read performance counter.
As per a8 trm, register should be enabled from privileged mode. Hence enabled the performance counter using a kernle module:
/* enable user-mode access to the performance counter*/
asm ("MCR p15, 0, %0, C9, C14, 0\n\t" :: "r"(1));
/* disable counter overflow interrupts (just in case)*/
asm ("MCR p15, 0, %0, C9, C14, 2\n\t" :: "r"(0x8000000f));
now trying to read the register:
asm ("MRC p15, 0, %0, c9, c14, 0\t\n": "=r"(value));
gives me 0 in user mode. Printing in the kernel init module gives 1 (while inserting).
why it differs ??
Thanks for your suggestions !!
User contributions licensed under CC BY-SA 3.0