0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-05-18 19:31:17 +03:00

Fixed PushImm16Handler registration order to correctly handle PUSH imm16 with operand size prefix

This commit is contained in:
bird_egop 2025-04-16 21:46:08 +03:00
parent fa1a7f582c
commit 8c9b34ef09

View File

@ -378,8 +378,10 @@ public class InstructionHandlerFactory
_handlers.Add(new PushRm32Handler(_decoder)); // PUSH r/m32 (opcode FF /6)
// Add PUSH immediate handlers
_handlers.Add(new PushImm32Handler(_decoder)); // PUSH imm32 (opcode 68)
// Note: Order matters! PushImm16Handler must be registered before PushImm32Handler
// since both check for opcode 68h but PushImm16Handler also checks for operand size prefix
_handlers.Add(new PushImm16Handler(_decoder)); // PUSH imm16 with operand size prefix (0x66 0x68)
_handlers.Add(new PushImm32Handler(_decoder)); // PUSH imm32 (opcode 68)
_handlers.Add(new PushImm8Handler(_decoder)); // PUSH imm8 (opcode 6A)
}