X86: Implement the bswap instruction.

This commit is contained in:
Gabe Black 2009-01-25 20:32:43 -08:00
parent 919c3e7fb6
commit 3c5988b86c
2 changed files with 24 additions and 2 deletions

View file

@ -915,7 +915,11 @@
default: Inst::UD2();
}
}
0x19: bswap_B();
0x19: decode OPSIZE {
4: Inst::BSWAP_D(Bd);
8: Inst::BSWAP_Q(Bq);
default: Inst::UD2();
}
0x1A: decode LEGACY_DECODEVAL {
// no prefix
0x0: decode OPCODE_OP_BOTTOM3 {

View file

@ -53,7 +53,25 @@
#
# Authors: Gabe Black
microcode = ""
microcode = '''
def macroop BSWAP_D_R
{
roli reg, reg, 8, dataSize=2
roli reg, reg, 16, dataSize=4
roli reg, reg, 8, dataSize=2
};
def macroop BSWAP_Q_R
{
roli reg, reg, 8, dataSize=2
roli reg, reg, 16, dataSize=4
roli reg, reg, 8, dataSize=2
roli reg, reg, 32, dataSize=8
roli reg, reg, 8, dataSize=2
roli reg, reg, 16, dataSize=4
roli reg, reg, 8, dataSize=2
};
'''
#let {{
# class BSWAP(Inst):
# "GenFault ${new UnimpInstFault}"