lcljesse
lcljesse

Reputation: 85

sucess compile but fail execute assemble MRC instruction on iOS?

I try to check ARM architecture ID in iOS (iPad/iPhone) code like

"mrc p15,0,r1,c0,c0,0"

The instruction pass compile but fail to execute, Xcode shows "EXC_BAD_INSTRUCTION". Any suggestions?

Upvotes: 0

Views: 389

Answers (2)

webshaker
webshaker

Reputation: 467

You can't use MRC with some specific register. This kind of acces are allowed only in SuperUser Mode. That's to says when the OS boot.

After that you will not be abble to acces this register.

You probably want to access to the cycle counter ? no ? I think this will not be possible on the iOS.

Upvotes: 0

Alexey Frunze
Alexey Frunze

Reputation: 62106

From the ARMv7 Architecture Reference Manual:

MRC

Move to ARM core register from Coprocessor causes a coprocessor to transfer a value to an ARM core register or to the condition flags. If no coprocessor can execute the instruction, an Undefined Instruction exception is generated.

Apparently, there just isn't where to read a value from.

Upvotes: 1

Related Questions