Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

assembler programming in user space

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();
}
like image 552
kumar Avatar asked May 10 '26 10:05

kumar


1 Answers

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.

like image 57
Alex Brown Avatar answered May 13 '26 00:05

Alex Brown



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!