[all-commits] [llvm/llvm-project] 7530e7: [X86] Ignore REX prefixes not immediately before o...

Aiden Grossman via All-commits all-commits at lists.llvm.org
Fri Nov 22 10:56:46 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7530e707afc60014624eb62bda9557cdc7f28dd0
      https://github.com/llvm/llvm-project/commit/7530e707afc60014624eb62bda9557cdc7f28dd0
  Author: Aiden Grossman <aidengrossman at google.com>
  Date:   2024-11-22 (Fri, 22 Nov 2024)

  Changed paths:
    M llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
    M llvm/test/MC/Disassembler/X86/x86-64.txt

  Log Message:
  -----------
  [X86] Ignore REX prefixes not immediately before opcode (#117299)

The Intel X86 Architecture Manual says the following:

> A REX prefix is ignored, as are its individual bits, when it is not
needed
> for an instruction or when it does not immediately precede the opcode
byte or
> the escape opcode byte (0FH) of an instruction for which it is needed.
This
> has the implication that only one REX prefix, properly located, can
affect an
> instruction.

We currently do not handle these cases in the disassembler, leading to
incorrect disassembly. This patch rectifies the situation by treating
REX prefixes as standard prefixes rather than only expecting them before
the Opcode.

The motivating test case added as a test was fuzzer generated.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list