Skip to content

Optimize X86#set_register to avoid \x00 bytes in the assembled output #346

@postmodern

Description

@postmodern

Optimize X86#set_register to avoid \x00 bytes in the assembled output when setting a register to a 8bit or 16bit immediate value.

mov reg32, imm8 and mov reg32, imm16 instructions encode the immediate value as a 32bit value with extra \x00 bytes. Instead set_register should clear the register using clear_register and set a sub-register of the register to the immediate value.

Example

set_register eax, 1

Expands to:

xor eax, eax
mov al, 1

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions