[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] lcall invalid hex code

From: Michael Matz
Subject: Re: [Tinycc-devel] lcall invalid hex code
Date: Mon, 2 May 2016 04:29:07 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)


On Sun, 1 May 2016, Sergey Korshunoff wrote:

diff --git a/i386-asm.h b/i386-asm.h
index 486cffe..637568b 100644
--- a/i386-asm.h
+++ b/i386-asm.h
@@ -213,7 +213,7 @@ ALT(DEF_ASM_OP1(jmp, 0xff, 0, OPC_JMP | OPC_WL, OPT_REGW))
ALT(DEF_ASM_OP2(lcall, 0x9a, 0, 0, OPT_IM16, OPT_IM32))
-ALT(DEF_ASM_OP1(lcall, 0xff, 3, 0, OPT_EA))
+ALT(DEF_ASM_OP1(lcall, 0xff1f, 3, 0, OPT_EA))
ALT(DEF_ASM_OP2(ljmp, 0xea, 0, 0, OPT_IM16, OPT_IM32))
ALT(DEF_ASM_OP1(ljmp, 0xff, 5, 0, OPT_EA))

You don't say what exactly you want to fix, but whatever it is, the patch is incorrect. 'lcall' is no two-byte opcode (those start with 0x0f), but rather the opcode is 0xff and the sub-opcode is in the mod/rm byte (aka. group #5 [1]). It's sub-opcode 3, hence correct above.

If anything the decoding of the above table in i386-asm.c is wrong, but I can't say without knowing what the problem is.

[1] See any decent x86 opcode listing, like sandpile.org or x86asm.net.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]