问题描述
我正在使用 ARM 程序集尝试访问多个协处理器寄存器.每当我有类似的事情
I'm using ARM Assembly trying to access several coprocessor registers. Whenever I have something like
mcr p15, #1, r1, c1, c0
或
mrc p15, #0, r0, c1, c0
我收到 signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 80400d00 错误,这意味着某些东西正在获取非法(我假设不存在)操作代码(指令).有几种可能性.mrc 和 mcr 指令本身可能是非法的,但代码编译时没有任何抱怨.如果这是特权模式问题,我希望看到的是 ILL_PRVOPC SIGILL.
I get signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 80400d00 error, which means that something is getting an illegal (non-existent, I assume) operation code (instruction). There are several possibilities. The mrc and mcr instructions themselves might be illegal, but the code compiles with no complaints. If this were a privileged mode issue, I'd expect to see a ILL_PRVOPC SIGILL instead.
另一种可能性是作为 mrc 和 mcr 一部分的操作码(语法是 MRC{2};coproc>、#、、、) 可能是非法的.我已经尝试了可能的操作码,但我仍然遇到相同的错误和相同的堆栈转储.
Another possibility is that the opcode that is a part of mrc and mcr (syntax is MRC{2}<c><q> <coproc>, #<opc1>, <Rt>, <CRn>, <CRm>) might be illegal. I've tried possible opcodes, but I'm still getting the same error and the same stack dump.
Android 通常是否允许有指示,还是我做错了什么?还有什么我应该考虑调试的吗?
Does Android generally allow there instructions or is it something I'm doing that's wrong? Anything else I should be looking at to debug?
推荐答案
确实是权限不够.您不能从用户模式执行此操作,它会导致转换为 SIGILL/ILL_ILLOPC 的未定义指令异常.grep -Hr PRVOPC <path-to-linux-kernel>/arch/arm 不会产生任何结果,而对 ILLOPC 执行相同操作将使您处于 do_undefinstr().
It is indeed due to insufficient provileges. You cannot do that from user-mode, it causes an Undefined Instruction exception that gets translated into SIGILL/ILL_ILLOPC. grep -Hr PRVOPC <path-to-linux-kernel>/arch/arm yields nothing, while doing the same for ILLOPC will land you at do_undefinstr().
这篇关于尝试在 Android 上执行 MRC 或 MCR 指令时获取 ILL_ILLOPC(非法操作码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!