Is it possible to have a piece of code like this in user space? I mean is it possible to read/write co-processor register in user space in Netbsd / Linux?
XYZ]# cat pmc.c
static inline int
arm11_pmc_ctrl_read(void)
{
unsigned int val;
__asm volatile ("mrc p15, 0, %0, c15, c12, 0" : "=r" (val));
return val;
}
int main(){
unsigned int ctrl;
ctrl = arm11_pmc_ctrl_read();
}
User space does not have access to privileged instructions or registers. Look in your assembler manual to find out if the instructions and registers you are using are privileged.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With