Skip to content

Commit d3a2711

Browse files
committed
Fixes for MIB operands and jmpabs
1 parent 4a9c09f commit d3a2711

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

include/Zydis/Internal/EncoderData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ typedef struct ZydisEncodableInstruction_
218218
/**
219219
* The vector length.
220220
*/
221-
ZyanU8 vector_length ZYAN_BITFIELD(ZYDIS_MANDATORY_PREFIX_REQUIRED_BITS);
221+
ZyanU8 vector_length ZYAN_BITFIELD(ZYDIS_VECTOR_LENGTH_REQUIRED_BITS);
222222
/**
223223
* The accepted sizing hint.
224224
*/

src/Encoder.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,7 +2856,8 @@ static ZyanBool ZydisIsDefinitionCompatible(ZydisEncoderInstructionMatch *match,
28562856
}
28572857

28582858
ZyanU8 eosz = 0;
2859-
if (match->base_definition->branch_type != ZYDIS_BRANCH_TYPE_NONE)
2859+
if ((match->base_definition->branch_type != ZYDIS_BRANCH_TYPE_NONE) &&
2860+
(match->base_definition->branch_type != ZYDIS_BRANCH_TYPE_ABSOLUTE))
28602861
{
28612862
switch (request->branch_width)
28622863
{
@@ -3220,8 +3221,9 @@ static ZyanStatus ZydisFindMatchingDefinition(const ZydisEncoderRequest *request
32203221
{
32213222
continue;
32223223
}
3223-
if ((base_definition->branch_type == ZYDIS_BRANCH_TYPE_NONE) &&
3224-
(request->branch_width != ZYDIS_BRANCH_WIDTH_NONE))
3224+
if (((base_definition->branch_type == ZYDIS_BRANCH_TYPE_NONE) ||
3225+
(base_definition->branch_type == ZYDIS_BRANCH_TYPE_ABSOLUTE)) &&
3226+
(request->branch_width != ZYDIS_BRANCH_WIDTH_NONE))
32253227
{
32263228
continue;
32273229
}
@@ -4507,11 +4509,11 @@ static ZyanStatus ZydisEncoderCheckRequestSanity(const ZydisEncoderRequest *requ
45074509
static const ZyanBool branch_lookup
45084510
[ZYDIS_BRANCH_WIDTH_MAX_VALUE + 1][ZYDIS_BRANCH_TYPE_MAX_VALUE + 1] =
45094511
{
4510-
/* NONE */ { ZYAN_TRUE, ZYAN_TRUE, ZYAN_TRUE, ZYAN_TRUE },
4511-
/* 8 */ { ZYAN_TRUE, ZYAN_TRUE, ZYAN_FALSE, ZYAN_FALSE },
4512-
/* 16 */ { ZYAN_TRUE, ZYAN_FALSE, ZYAN_TRUE, ZYAN_TRUE },
4513-
/* 32 */ { ZYAN_TRUE, ZYAN_FALSE, ZYAN_TRUE, ZYAN_TRUE },
4514-
/* 64 */ { ZYAN_TRUE, ZYAN_FALSE, ZYAN_TRUE, ZYAN_TRUE },
4512+
/* NONE */ { ZYAN_TRUE, ZYAN_TRUE, ZYAN_TRUE, ZYAN_TRUE, ZYAN_FALSE },
4513+
/* 8 */ { ZYAN_TRUE, ZYAN_TRUE, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE },
4514+
/* 16 */ { ZYAN_TRUE, ZYAN_FALSE, ZYAN_TRUE, ZYAN_TRUE, ZYAN_FALSE },
4515+
/* 32 */ { ZYAN_TRUE, ZYAN_FALSE, ZYAN_TRUE, ZYAN_TRUE, ZYAN_FALSE },
4516+
/* 64 */ { ZYAN_TRUE, ZYAN_FALSE, ZYAN_TRUE, ZYAN_TRUE, ZYAN_FALSE },
45154517
};
45164518
if (!branch_lookup[request->branch_width][request->branch_type])
45174519
{

src/Generated/InstructionDefinitions.inc

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)