Here is the kernel module source code which works OK on Raspberry Pi 3, armv7 architecture:
void
enable_ccr(
*info) {
asm
volatile
(
"MCR p15, 0, %0, c9, c14, 0"
::
"r"
(1));
"MCR p15, 0, %0, c9, c12, 0\t\n"
"MCR p15, 0, %0, c9, c12, 1\t\n"
(0x80000000));
}
I have now switched my Raspberry Pi to 64-bit Linux Ubuntu OS, so the architecture is aarch64.
When I try to compile the source, I get error:
Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c14,0'
How do I fix this?
Hi ,
In AArch64, the system registers are accessed using the MSR (and MRS) instructions.
The AArch32 registers PMUSERENR, PMCR and PMCNTENSET your 32b code is accessing need to be replaced by the AArch64 registers PMUSERENR_EL0, PMCR_EN0 and PMCNTENSET_EL0.
Best regards,
Vincent.