This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Accessing CP14 from user mode

Note: This was originally posted on 9th July 2009 at http://forums.arm.com

Hello,

   I'm currently trying to change the frequency of a PXA270 processor, the system I'm working on is a Linux  OS, and I would like to write a code that allows an user to change the frequency, to do so I need to write in a register of coprocessor 14. According to ARM documentation i need to use MRC/MCR instructions, I tried but I got an error : "Illegal instruction".

   So I think I need to switch to supervisor mode, it seems that I could do it using SWI but even after reading some documentation I don't know how I should implement this.
I'm not even sure that what I want to do is possible, but if it is, does someone have any idea of the code I should write to switch to supervisor mode and use MRC or MCR instruction?

Thanks,
Parents
  • Note: This was originally posted on 9th July 2009 at http://forums.arm.com

    When in User mode the only way to switch to a different (priviledged) mode is by taking an exception.  For example by excuting a SWI/SVC instruction to trigger a Supervisor call exception.  On a bare metal system you would have to provide a vector table and exception handlers.  The handlers could deal with the accesses to CP14.  But...

    As you are running under an OS, the OS will handle the exceptions.  I suspect you will have to write a Linux kernel driver to control the frequency changing.  Then your application uses the driver as an interface.  Not a Linux developer, so can't say how you'd do this.
Reply
  • Note: This was originally posted on 9th July 2009 at http://forums.arm.com

    When in User mode the only way to switch to a different (priviledged) mode is by taking an exception.  For example by excuting a SWI/SVC instruction to trigger a Supervisor call exception.  On a bare metal system you would have to provide a vector table and exception handlers.  The handlers could deal with the accesses to CP14.  But...

    As you are running under an OS, the OS will handle the exceptions.  I suspect you will have to write a Linux kernel driver to control the frequency changing.  Then your application uses the driver as an interface.  Not a Linux developer, so can't say how you'd do this.
Children
No data