6

I am trying to compile "mrc" and "mcr" instruction on AARCH64 based on Board but I am seeing below error message

   tmp/ccqOHmrK.s: Assembler messages:
  /tmp/ccqOHmrK.s:43: Error: unknown mnemonic `mrc' -- `mrc p15,0,x0,c14,c3,1'
  /tmp/ccqOHmrK.s:53: Error: unknown mnemonic `mrc' -- `mrc p15,0,x2,c14,c3,0'

I tried looking into the kernel source /arch/arm64 but no where mcr&&mrc has been used without emulation.

Is it some syntax issue?

artless noise
  • 21,212
  • 6
  • 68
  • 105
Amit Singh Tomar
  • 8,380
  • 27
  • 120
  • 199

2 Answers2

10

You should replace these with the appropriate msr instructions. For example, arch/arm/include/asm/arch_timer.h has:

case ARCH_TIMER_REG_CTRL:
    asm volatile("mcr p15, 0, %0, c14, c3, 1" : : "r" (val));

The counterpart in arch/arm64/include/asm/arch_timer.h has:

case ARCH_TIMER_REG_CTRL:
    asm volatile("msr cntv_ctl_el0,  %0" : : "r" (val));
Jester
  • 56,577
  • 4
  • 81
  • 125
0

MCR and MRC don't exist in ARMv8.

In ARMv7-A, system registers were typically accessed through coprocessor 15 (CP15) operations and accessed using MCR and MRC. However, AArch64 does not include support for coprocessors.

In AArch64, system configuration is controlled through system registers, and accessed using MSR and MRS instructions.

If you want to access a system register, you could refer to Arm Architecture Reference Manual. For example, PMSELR_EL0 in D13.4.15. enter image description here

axiqia
  • 302
  • 4
  • 13