Skip to content

Preserve OSIZE for APX EVEX MAP4#378

Open
RatinCN wants to merge 1 commit into
microsoft:mainfrom
RatinCN:fix/evex-map4-osize
Open

Preserve OSIZE for APX EVEX MAP4#378
RatinCN wants to merge 1 commit into
microsoft:mainfrom
RatinCN:fix/evex-map4-osize

Conversation

@RatinCN
Copy link
Copy Markdown
Contributor

@RatinCN RatinCN commented May 25, 2026

Addendum to #374, already fixed in my SlimDetours in commit da1e214.

EVEX MAP4 promotes legacy integer instructions, so EVEX.pp=01 can still act as an operand-size override when W=0. Keep mandatory-prefix fixed sizing for other VEX/EVEX maps, but allow MAP4 to select nFixedSize16.

#374 made all VEX/EVEX instructions use nFixedSize, ignoring m_bOperandOverride.
That is correct for ordinary VEX/EVEX maps where pp is a mandatory prefix, but APX EVEX MAP4 promotes legacy integer instructions.
For MAP4, EVEX.pp=01 can still act as OSIZE when EVEX.W=0.

For example, an APX EVEX MAP4 Group 1 immediate instruction with pp=66, W=0, and opcode 81 /0 should consume an imm16. The current logic consumes imm32, over-reading two bytes from the following instruction.

62 04 05 00	EVEX.66.MAP4.W0
81 C0		Group 1 /0, register form
34 12		imm16

After applying this PR, this instruction will be calculated as 8 bytes in size, no longer 10 bytes.

EVEX MAP4 promotes legacy integer instructions, so EVEX.pp=01 can still act as an operand-size override when W=0. Keep mandatory-prefix fixed sizing for other VEX/EVEX maps, but allow MAP4 to select nFixedSize16.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant