mirror of
https://github.com/keystone-engine/keystone
synced 2026-06-08 15:15:30 +00:00
x86: fix issue #214
This commit is contained in:
@@ -167,7 +167,7 @@ private:
|
||||
InfixOperatorStack.push_back(Op);
|
||||
}
|
||||
|
||||
int64_t execute(unsigned int &KsError) { // qq
|
||||
int64_t execute(unsigned int &KsError) {
|
||||
// Push any remaining operators onto the postfix stack.
|
||||
while (!InfixOperatorStack.empty()) {
|
||||
InfixCalculatorTok StackOp = InfixOperatorStack.pop_back_val();
|
||||
@@ -2584,8 +2584,14 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
Parser.eatToEndOfStatement();
|
||||
return true;
|
||||
}
|
||||
// check for comma and eat it
|
||||
if (getLexer().is(AsmToken::Comma))
|
||||
// for LJMP, check for ':'. otherwise, check for comma and eat it
|
||||
if (Name.startswith("ljmp") || Name.startswith("ljmp")) {
|
||||
if (getLexer().is(AsmToken::Colon)) {
|
||||
//Parser.Lex();
|
||||
Operands.push_back(X86Operand::CreateToken(":", consumeToken()));
|
||||
} else
|
||||
break;
|
||||
} else if (getLexer().is(AsmToken::Comma))
|
||||
Parser.Lex();
|
||||
else
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Test if "jmp 0x33, 08" throws an error.
|
||||
# Test if "ljmp 0x33:08" throws an error.
|
||||
|
||||
# Github issue: #214
|
||||
# Author: Duncan (mrexodia)
|
||||
@@ -15,10 +15,10 @@ class TestX86Intel(regress.RegressTest):
|
||||
ks = Ks(KS_ARCH_X86, KS_MODE_32)
|
||||
# Assemble with zero addr
|
||||
try:
|
||||
encoding, count = ks.asm("jmp 0x33, 08", 0)
|
||||
self.fail()
|
||||
encoding, count = ks.asm("ljmp 0x33:08", 0)
|
||||
self.assertEqual(encoding, [ 0xea, 0x08, 0x00, 0x30, 0x00 ])
|
||||
except KsError as e:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
regress.main()
|
||||
regress.main()
|
||||
|
||||
Reference in New Issue
Block a user