异常:使用无意义的REX前缀 [英] ANOMALY: meaningless REX prefix used

查看:1377
本文介绍了异常:使用无意义的REX前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误ANOMALY: meaningless REX prefix used是什么意思?我已经在Google上搜索过,并且我得到的所有信息都是与Java或AVG或Minecraft(由于Java)有关的完全随机的.

What does the error ANOMALY: meaningless REX prefix used mean? I have googled and all information I got was completly random that it is related to java or avg or minecraft (because of java).

但是,在合并c ++ opengl 4.0图形引擎的多个分支后,我的Visual Studio控制台应用程序的控制台输出中出现了此错误,并且突然弹出了该错误.我可能已经在编写它们的时间点之间更新了AMD图形驱动程序,因此这可能是一个来源.错误弹出后,深度缓冲区测试也突然被禁用.

However, I got this error in the console output of my Visual Studio console application after I merged several branches of my c++ opengl 4.0 graphics engine and it suddenly popped up. I might have updated the AMD graphics driver between the time points I have written them, so this could be one source. After the error popped up also the depth buffer test was suddenly disabled.

在Visual Studio中使用Clean和Rebuild之后,错误现在消失了,因此我不需要修复错误的帮助,但是我想知道它的含义以及通常导致此错误的原因.令我感到好奇的是,我没有发现任何有用的搜索此错误的信息.

After using clean and rebuild in visual studio the error is gone now, I therefore do not need help in fixing the error but I would like to know what it means and what in general causes this error. It makes me curious as I have not found ANYTHING useful searching for this error.

推荐答案

Myria在评论中说:

Myria in the comments said:

指的是不需要REX前缀字节的x86-64汇编指令
It's referring to an x86-64 assembly instruction using a REX prefix byte when it didn't need to

为此,在几种不同的情况下,REX前缀将被忽略.

To expand upon this, REX prefixes are ignored in a few different scenarios.

  1. 如果ModR/M字段指定其他寄存器或扩展操作码.

  1. If the ModR/M field specifies other registers or an extended opcode.

如果一条指令中使用了多个REX前缀(尽管我阅读了 osdev.org 这是未定义的

If more than 1 REX prefix is used in an instruction (though I read on osdev.org this is undefined

如果不遵循常规格式.例如,除非与强制性前缀结合使用,否则REX前缀必须在操作码或转义操作码字节之前.在这种情况下,REX可以紧接在操作码/转义字节之后.

If general formatting isn't followed. For example the REX prefix must precede the opcode or escape opcode byte unless being used in conjunction with a mandatory prefix. In which case REX can be right after the opcode/escape byte.

如果尝试在64位模式下使用INC/DEC的单字节形式.

If you try to use the single byte form of INC/DEC in 64 bit mode.

看起来像这样的ANOMALY消息会在从git到Java的各种上下文中显示相关程序(可能是您正在引用的程序),其中的问题似乎出在新驱动程序上.罪魁祸首:Raptr,它带有AMD的Radeon驱动程序.在Java帖子中,有人报告使用SAPPHIRE Radeon HD 5850,在我将与您链接的下一个站点上,一个人使用AMD R9 390,另一个人使用380.在这种情况下,有人在其 64位Win7 系统.现在,此人的站点带我经过Raptr所使用的一个钩子(该钩子连接到opengl32.dll),该钩子称为 mhook ,我开始研究"Windows API挂钩库",并发现此

Looks like this ANOMALY message displays in a variety of contexts from git to Java related programs (maybe the one you are referencing) in which a new driver seems to have been the problem. The culprit: Raptr, which comes with AMD's Radeon drivers. In the Java post someone reported using SAPPHIRE Radeon HD 5850 and on the next site I'll link you to, one person was using AMD R9 390 and another the 380. In this context someone saw the message on the console of their 64-bit Win7 sys. Now this person's site took me through a hook Raptr was using (which connects to the opengl32.dll) called mhook, I started digging through this 'Windows API hooking library' and found this starting on line 1230:

assert(X86Instruction->AddressSize >= 4);
    if (X86Instruction->rex.w)
    {
        X86Instruction->OperandSize = 8;
        X86Instruction->HasOperandSizePrefix = FALSE;
    }
    else if (X86Instruction->HasOperandSizePrefix)
    {
        assert(X86Instruction->OperandSize == 2);
    }
    else if (X86Instruction->rex_b == REX_PREFIX_START)
    {
        if (!Instruction->AnomalyOccurred)
        {
            if (!SuppressErrors) printf("[0x%08I64X] ANOMALY: meaningless REX prefix used\n", VIRTUAL_ADDRESS);
            Instruction->AnomalyOccurred = TRUE;
        }
        X86Instruction->rex_b = 0;
    }

总而言之,当软件像Windows API库一样处理REX前缀忽略时,就会出现此异常消息.

因此,您在正确的位置就拥有了它. mhook库甚至还有一长串要忽略的Visual Studio文件.
附加说明* 我从 os2museum
网站找到了此评论整个奥秘

To summarize, this ANOMALY message occurs when software handles a REX prefix ignore, like this Windows API library does.

So there you have it, you were in all the right places. The mhook library even has a long list of Visual Studio files to ignore.
additional note* I found this comment from the os2museum site a good clue to this whole mystery

Windows amd64 ABI要求函数的第一个操作码的长度至少为2个字节. (我认为这样可以对函数进行热修补.)很多时候,第一条指令是"push",但该指令具有1字节的编码!为了符合ABI,在指令中添加了rex前缀,使其成为2个字节-"rex push rbp"或"rex push rbx"或其他内容.编译器会为您执行此操作,但是如果您要在汇编器中编写函数,则需要记住该规则.
The Windows amd64 ABI requires that the first opcode of a function be at least 2 bytes in length. (I think this is so the function can be hotpatched.) Many times the first instruction is "push " but the instruction has a 1-byte encoding! To comply with the ABI, a rex prefix is added to the instruction, making it 2 bytes — "rex push rbp" or "rex push rbx" or whatever. The compiler does this for you, but if you are writing a function in assembler, you need to remember the rule.

在这个特定的钩子库中,其他有趣的错误消息(只是其中的一些!)包括

Other fun error messages (just a few of many!) in this particular hook library include

ANOMALY: Meaningless segment override

ANOMALY: REX prefix before legacy prefix 0x%02X\n

ANOMALY: Conflicting prefix\n

ANOMALY: Reached maximum prefix count %d\n

和我的最爱:

ANOMALY: branch into the middle of an instruction\n

而且由于我自己也无法帮助自己,可能值得注意的是这些默认为64位操作数的指令:

And just because I can't help myself, it might be worth noting these are the instructions that default to 64-bit operands:



+--------------+------------+-------------+
| CALL (near)  | ENTER      | Jcc         |
+--------------+------------+-------------+
| JrCXZ        | JMP (near) | LEAVE       |
+--------------+------------+-------------+
| LGDT         | LIDT       | LLDT        |
+--------------+------------+-------------+
| LOOP         | LOOPcc     | LTR         |
+--------------+------------+-------------+
| MOV CR(n)    | MOV DR(n)  | POP reg/mem |
+--------------+------------+-------------+
| POP reg      | POP FS     | POP GS      |
+--------------+------------+-------------+
| POPFQ        | PUSH imm8  | PUSH imm32  |
+--------------+------------+-------------+
| PUSH reg/mem | PUSH reg   | PUSH FS     |
+--------------+------------+-------------+
| PUSH GS      | PUSHFQ     | RET (near)  |
+--------------+------------+-------------+

这篇关于异常:使用无意义的REX前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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