Getting ILL_ILLOPC (illegal operation code) when trying to execute MRC or MCR instructions on Android

I am using ARM Assembly, trying to access multiple coprocessor registers. Whenever I have something like

mcr p15, #1, r1, c1, c0 

or

 mrc p15, #0, r0, c1, c0 

I get an error signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 80400d00 , which means that something is getting an illegal (nonexistent, I guess) operation code (instruction). There are several possibilities. The mrc and mcr instructions themselves may be illegal, but the code compiles without any complaints. If this were a problem with privileged mode, I would expect to see ILL_PRVOPC SIGILL.

Another possibility is that the operation code, which is part of mrc and mcr (syntax MRC{2}<c><q> <coproc>, #<opc1>, <Rt>, <CRn>, <CRm> ), may be illegal. I tried possible opcodes, but I still get the same error and the same stack dump.

Does Android support instructions at all or is this what I'm doing wrong? Is there anything else I should look for for debugging?

+2
assembly android arm
Oct 07 '11 at 18:28
source share
1 answer

This is really due to insufficient strongholds. You cannot do this from user mode, it raises the Undefined Instruction exception, which translates to SIGILL / ILL_ILLOPC. grep -Hr PRVOPC <path-to-linux-kernel>/arch/arm gives nothing, doing the same for ILLOPC, you will land on do_undefinstr() .

+4
Oct 08 2018-11-11T00:
source share
— -



All Articles