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

Error: unknown mnemonic `mcr' for aarch64?

Former Member
Former Member

Here is the kernel module source code which works OK on Raspberry Pi 3, armv7 architecture: 

void enable_ccr(void *info) {
   asm volatile ("MCR p15, 0, %0, c9, c14, 0" :: "r" (1));
   asm volatile ("MCR p15, 0, %0, c9, c12, 0\t\n" :: "r"(1));
   asm volatile ("MCR p15, 0, %0, c9, c12, 1\t\n" :: "r"(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?

Parents
  • 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.

Reply
  • 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.

Children
No data