namespace X86Disassembler.X86.Handlers.Stack; /// /// Handler for LEAVE instruction (0xC9) /// High-level procedure exit that releases the stack frame set up by a previous ENTER instruction /// public class LeaveHandler : InstructionHandler { /// /// Initializes a new instance of the LeaveHandler class /// /// The instruction decoder that owns this handler public LeaveHandler(InstructionDecoder decoder) : base(decoder) { } /// /// Checks if this handler can decode the given opcode /// /// The opcode to check /// True if this handler can decode the opcode public override bool CanHandle(byte opcode) { // LEAVE is 0xC9 return opcode == 0xC9; } /// /// Decodes a LEAVE instruction /// /// The opcode of the instruction /// The instruction object to populate /// True if the instruction was successfully decoded public override bool Decode(byte opcode, Instruction instruction) { // Set the instruction type instruction.Type = InstructionType.Leave; // LEAVE has no operands instruction.StructuredOperands = []; return true; } }