Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Perlito5::X64::Assembler - add shld, shrd, rdtsc
  • Loading branch information
fglock committed Mar 24, 2013
1 parent d2b88ac commit c50d5a9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src5/lib/Perlito5/X64/Assembler.pm
Expand Up @@ -215,23 +215,23 @@ sub _movsxlq {
}
}

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

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

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

sub repmovsq() {
sub _repmovsq() {
emit(0xF3);
emit_rex_64();
emit(0xA5);
Expand Down Expand Up @@ -287,6 +287,11 @@ sub _pushfq {
emit(0x9C);
}

sub _rdtsc {
emit(0x0F);
emit(0x31);
}

sub _ret {
my ( $imm16 ) = @_;
if ( !$imm16 ) {
Expand All @@ -299,6 +304,22 @@ sub _ret {
}
}

sub _shld {
my ( $dst, $src ) = @_;
emit_rex_64($src, $dst);
emit(0x0F);
emit(0xA5);
emit_modrm($src, $dst);
}

sub _shrd {
my ( $dst, $src ) = @_;
emit_rex_64($src, $dst);
emit(0x0F);
emit(0xAD);
emit_modrm($src, $dst);
}

1;

__END__
Expand Down
5 changes: 5 additions & 0 deletions t5-x64/01_sanity.t
Expand Up @@ -50,5 +50,10 @@ say "1..4";
asm_reset();
_movq( rax, rcx );
say "# movq " . to_hex();

asm_reset();
_shld( rax, rcx );
say "# shld " . to_hex();

}

0 comments on commit c50d5a9

Please sign in to comment.