What does mrc p15 do in ARM inline assembly, and how does GNU C inline asm syntax work?

前端 未结 2 496
孤独总比滥情好
孤独总比滥情好 2020-12-22 13:30

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

2条回答
  •  清歌不尽
    2020-12-22 13:50

    The coprocessors in the arm are more obvious/visible perhaps than other processors. Nevertheless this is a coprocessor access function, the coprocessor interface is generic these instructions are generic as if you are just filling in items on a generic bus. Now arm does re-use things in that a coprocessor register in one core if present in another is more likely than not to be related or the same. The right answer is to go to the arm website (infocenter.arm.com) and find both the arm arm (arm architectural reference manual) and trm (technical reference manual) for the family and core of processor you are using or looking at code for, in one or both manuals it will have a section on coprocessors and as you push into that section you will see the coprocessor number then register within that coprocessor and some of the numbers will make sense. ARM generally will say, to read this register here is the exact instruction, to write this register here is the exact instruction, and it will take the form as you have presented it. If you are looking to go backwards from code to what it does you will see that you can very quickly work your way into that section of the manual and quickly find the instruction then see what it does for that particular core or family. The other way around is to look at chapter and section titles finding the register of interest then the syntax for the instruction used to manipulate it.

    As far as the : : double colons, I am guessing you took this from inline assembly and that is related to inline assembly, a compiler thing and is not related at all to the arm instruction, the arm instruction ends with the c13, 0.

提交回复
热议问题