Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Perlito5::X64::Assembler - add repmovs variants
  • Loading branch information
fglock committed Mar 24, 2013
1 parent 54135fa commit d2b88ac
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src5/lib/Perlito5/X64/Assembler.pm
Expand Up @@ -115,7 +115,11 @@ sub emitl {

sub emit_rex_64 {
my ($reg, $rm_reg) = @_;
if ( is_register($reg) && is_register($rm_reg) ) {
if ( !@_ ) {
# Emit a REX prefix that only sets REX.W to choose a 64-bit operand size.
emit(0x48);
}
elsif ( is_register($reg) && is_register($rm_reg) ) {
emit(0x48 | $reg->high_bit() << 2 | $rm_reg->high_bit());
}
else {
Expand Down Expand Up @@ -211,6 +215,28 @@ sub _movsxlq {
}
}

sub repmovsb() {
emit(0xF3);
emit(0xA4);
}

sub repmovsw() {
emit(0x66); # Operand size override.
emit(0xF3);
emit(0xA4);
}

sub repmovsl() {
emit(0xF3);
emit(0xA5);
}

sub repmovsq() {
emit(0xF3);
emit_rex_64();
emit(0xA5);
}

sub _nop {
emit(0x90);
}
Expand Down

0 comments on commit d2b88ac

Please sign in to comment.