mrc p15在ARM内联汇编中起什么作用,GNU C内联asm语法如何工作? [英] What does mrc p15 do in ARM inline assembly, and how does GNU C inline asm syntax work?

查看:381
本文介绍了mrc p15在ARM内联汇编中起什么作用,GNU C内联asm语法如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

装配臂中的这条线有什么作用?

what does this line in assembly arm does?

mrc p15, 0, %0, c9, c13, 0" : : "r" (counter)

谁是p15难道不是r15其他人是什么?

who is p15 isn't it should be r15 what are all the others?

::是什么?c9, c1每个自变量的作用是什么?

what is :: who are c9, c1 what is the role of each argument?

推荐答案

MRC是通用协处理器互操作指令,cp15控制处理器-所有这些ARM CPU已经被ARM使用,这已被ARM用来扩展诸如高速缓存,MMU,性能监控之类的片上单元的指令集,此外还有许多其他功能.

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.

每次只需一点指令:

mrc p15, 0, %0, c9, c13, 0" : : "r" (counter)

根据 ARM Cortex A7 MPCore参考指令格式为:

MRC{cond} P15, <Opcode_1>, <Rd>, <CRn>, <CRm>, <Opcode_2>

在第4-11页上,这被描述为将CPU寄存器转移到性能监视器计数寄存器(我猜是count=0,这是性能计数器的重置).

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).

关于内联汇编器的语法.请参阅以获取x86概述-可能类似于ARM.

As for the syntax of inline assembler. refer to this for a x86 overview - which is probably similar to ARM.

: : "r" (counter)表示指令具有:

  • 寄存器中没有需要以局部变量结尾的输出
  • 从变量counter获取输入,并且该寄存器所在的寄存器应用作%0.
  • 编译器没有应注意的副作用(clobbers)
  • No output in a register that needs to end up in a local variable
  • Takes input from variable counter, and the register this is in should be used as %0.
  • There are no side effects the compiler ought to be aware of (clobbers)

这篇关于mrc p15在ARM内联汇编中起什么作用,GNU C内联asm语法如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆