mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Fixed a bug where diassembling an instruction that had a prefix would cause LLVM to identify a 1-byte instruction, but then upon querying it for that 1-byte instruction would cause an undefined opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189698 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -314,20 +314,22 @@ static int readPrefixes(struct InternalInstruction* insn) {
|
||||
while (isPrefix) {
|
||||
prefixLocation = insn->readerCursor;
|
||||
|
||||
/* If we fail reading prefixes, just stop here and let the opcode reader deal with it */
|
||||
if (consumeByte(insn, &byte))
|
||||
return -1;
|
||||
break;
|
||||
|
||||
/*
|
||||
* If the byte is a LOCK/REP/REPNE prefix and not a part of the opcode, then
|
||||
* break and let it be disassembled as a normal "instruction".
|
||||
*/
|
||||
if (insn->readerCursor - 1 == insn->startLocation && byte == 0xf0)
|
||||
break;
|
||||
|
||||
uint8_t nextByte;
|
||||
if (insn->readerCursor - 1 == insn->startLocation
|
||||
&& (byte == 0xf0 || byte == 0xf2 || byte == 0xf3)) {
|
||||
uint8_t nextByte;
|
||||
if (byte == 0xf0)
|
||||
break;
|
||||
if (lookAtByte(insn, &nextByte))
|
||||
return -1;
|
||||
&& (byte == 0xf2 || byte == 0xf3)
|
||||
&& !lookAtByte(insn, &nextByte))
|
||||
{
|
||||
/*
|
||||
* If the byte is 0xf2 or 0xf3, and any of the following conditions are
|
||||
* met:
|
||||
|
Reference in New Issue
Block a user