How to enable performance counter in ARM Cortex-A8 processor?

-1

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 !!

c
kernel
arm
inline-assembly
cortex-a8
asked on Stack Overflow Mar 15, 2013 by San • edited Mar 18, 2013 by San

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0