what does this line in assembly arm does?
mrc p15, 0, %0, c9, c13, 0\" : : \"r\" (counter)
who is p15
isn\'t it should be
Whilst MRC
is a generic co-processor inter-op instruction, cp15
is the control processor - which all modern ARM CPUs have and this has been used by ARM was a means of extending the instruction set for on-chip units such as the cache, MMU, performance monitoring and lots else besides.
Taking your instruction a bit at a time:
mrc p15, 0, %0, c9, c13, 0" : : "r" (counter)
According to the ARM Cortex A7 MPCore Reference the instruction format is:
MRC{cond} P15,
And on Page 4-11 this is described as a transfer of a CPU register to the performance monitor count register (I guess count=0
and this is a reset of the performance counter).
As for the syntax of inline assembler. refer to this for a x86 overview - which is probably similar to ARM.
The : : "r" (counter)
means that the instruction has:
counter
, and the register this is in should be used as %0
.