fix(disasm): name the amd64 families x/arch decodes to the zero opcode
x/arch reports the ADCX, ADOX, RDSEED, RDPID, TPAUSE, UMONITOR, UMWAIT and ENDBR families with no error but the degenerate zero instruction, which GoSyntax renders as Op(0) under its prefix decoration and with a length of one. A supplementary naming table keyed by the opcode pattern restores the toolchain's own spellings and lengths; the parity fixtures pin all 41 corpus rows (ENDBR32 alone, which the toolchain cannot spell, pins as bytes and text in the focused naming test). Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
6c4932c4ec
commit
dd356b9e6a
4 files changed
+498
No files matched your search
@@ -70,6 +70,16 @@ func Decode(a arch.Arch, code []byte, addr uint64) (Instruction, error) {
|
||||
if err != nil {
|
||||
return Instruction{Addr: addr, Text: "???", Len: 1}, nil
|
||||
}
|
||||
if inst.Op == 0 {
|
||||
// x/arch reports a few opcode families with no error but the
|
||||
// degenerate zero instruction: no opcode, no operands and a
|
||||
// length of one, which GoSyntax renders as "Op(0)". The
|
||||
// supplementary naming table restores the families the Go
|
||||
// toolchain names; anything else keeps the placeholder.
|
||||
if text, n, ok := nameAMD64Degenerate(code); ok {
|
||||
return Instruction{Addr: addr, Text: text, Len: n}, nil
|
||||
}
|
||||
}
|
||||
return Instruction{Addr: addr, Text: x86asm.GoSyntax(inst, addr, nil), Len: inst.Len}, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user