ARM Cortex A8 PMNC read gives 0 after enabling also.. Any Idea/Suggestions?

跟風遠走 提交于 2019-12-02 15:03:25

问题


MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("user-mode access to performance registers");

int __init arm_init(void)

{
    unsigned int value;

    /* enable user-mode access */
    printk(KERN_INFO "enable user-mode access\n");
    asm ("MCR p15, 0, %0, C9, C14, 0\n\t" :: "r"(1));

    /* Reading the value here--just to check */

    asm ("MRC p15, 0, %0, c9, c14, 0\t\n": "=r"(value));
    printk("value: %d\n", value);


    /* disable counter overflow interrupts (just in case)*/
    printk(KERN_INFO "disable counter overflow interrupts (just in case)\n");
    asm ("MCR p15, 0, %0, C9, C14, 2\n\t" :: "r"(0x8000000f));

    printk(KERN_INFO "user-mode access to performance registers enabled\n");
    return 0;
}


void arm_exit(void)
{
    unsigned int value;
    asm ("MRC p15, 0, %0, c9, c14, 0\t\n": "=r"(value));
    printk("value: %d\n", value);
    printk(KERN_INFO "user-mode access to performance registers disabled\n");
}

module_init(arm_init);
module_exit(arm_exit);

In init module read gives 1, but in cleanup module reading the variable gives 0. Any idea how does it get updated ?

来源:https://stackoverflow.com/questions/15492120/arm-cortex-a8-pmnc-read-gives-0-after-enabling-also-any-idea-suggestions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!