diff options
Diffstat (limited to 'src/arch/x86/insts')
-rw-r--r-- | src/arch/x86/insts/microldstop.cc | 6 | ||||
-rw-r--r-- | src/arch/x86/insts/microldstop.hh | 7 | ||||
-rw-r--r-- | src/arch/x86/insts/microregop.cc | 10 | ||||
-rw-r--r-- | src/arch/x86/insts/microregop.hh | 2 | ||||
-rw-r--r-- | src/arch/x86/insts/static_inst.cc | 17 | ||||
-rw-r--r-- | src/arch/x86/insts/static_inst.hh | 21 |
6 files changed, 44 insertions, 19 deletions
diff --git a/src/arch/x86/insts/microldstop.cc b/src/arch/x86/insts/microldstop.cc index 8a52ad932..9628256e4 100644 --- a/src/arch/x86/insts/microldstop.cc +++ b/src/arch/x86/insts/microldstop.cc @@ -66,13 +66,13 @@ namespace X86ISA std::stringstream response; printMnemonic(response, instMnem, mnemonic); - printReg(response, data, dataSize); + printDestReg(response, 0, dataSize); response << ", "; printSegment(response, segment); ccprintf(response, ":[%d*", scale); - printReg(response, index, addressSize); + printSrcReg(response, 0, addressSize); response << " + "; - printReg(response, base, addressSize); + printSrcReg(response, 1, addressSize); ccprintf(response, " + %#x]", disp); return response.str(); } diff --git a/src/arch/x86/insts/microldstop.hh b/src/arch/x86/insts/microldstop.hh index ae03d176e..8fef14121 100644 --- a/src/arch/x86/insts/microldstop.hh +++ b/src/arch/x86/insts/microldstop.hh @@ -76,6 +76,7 @@ namespace X86ISA const RegIndex data; const uint8_t dataSize; const uint8_t addressSize; + RegIndex foldOBit, foldABit; //Constructor LdStOp(ExtMachInst _machInst, @@ -92,7 +93,11 @@ namespace X86ISA disp(_disp), segment(_segment), data(_data), dataSize(_dataSize), addressSize(_addressSize) - {} + { + foldOBit = (dataSize == 1 && !_machInst.rex.present) ? 1 << 6 : 0; + foldABit = + (addressSize == 1 && !_machInst.rex.present) ? 1 << 6 : 0; + } std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const; diff --git a/src/arch/x86/insts/microregop.cc b/src/arch/x86/insts/microregop.cc index 976b04688..e67a82d4f 100644 --- a/src/arch/x86/insts/microregop.cc +++ b/src/arch/x86/insts/microregop.cc @@ -173,11 +173,11 @@ namespace X86ISA std::stringstream response; printMnemonic(response, instMnem, mnemonic); - printReg(response, dest, dataSize); + printDestReg(response, 0, dataSize); response << ", "; - printReg(response, src1, dataSize); + printSrcReg(response, 0, dataSize); response << ", "; - printReg(response, src2, dataSize); + printSrcReg(response, 1, dataSize); return response.str(); } @@ -187,9 +187,9 @@ namespace X86ISA std::stringstream response; printMnemonic(response, instMnem, mnemonic); - printReg(response, dest, dataSize); + printDestReg(response, 0, dataSize); response << ", "; - printReg(response, src1, dataSize); + printSrcReg(response, 0, dataSize); ccprintf(response, ", %#x", imm8); return response.str(); } diff --git a/src/arch/x86/insts/microregop.hh b/src/arch/x86/insts/microregop.hh index f411c0775..f465ac651 100644 --- a/src/arch/x86/insts/microregop.hh +++ b/src/arch/x86/insts/microregop.hh @@ -113,6 +113,7 @@ namespace X86ISA const RegIndex dest; const uint8_t dataSize; const uint16_t ext; + RegIndex foldOBit; // Constructor RegOpBase(ExtMachInst _machInst, @@ -128,6 +129,7 @@ namespace X86ISA src1(_src1), dest(_dest), dataSize(_dataSize), ext(_ext) { + foldOBit = (dataSize == 1 && !_machInst.rex.present) ? 1 << 6 : 0; } //Figure out what the condition code flags should be. diff --git a/src/arch/x86/insts/static_inst.cc b/src/arch/x86/insts/static_inst.cc index 9b2f81e49..948a74bc1 100644 --- a/src/arch/x86/insts/static_inst.cc +++ b/src/arch/x86/insts/static_inst.cc @@ -117,15 +117,27 @@ namespace X86ISA { assert(size == 1 || size == 2 || size == 4 || size == 8); static const char * abcdFormats[9] = - {"", "%sl", "%sx", "", "e%sx", "", "", "", "r%sx"}; + {"", "%s", "%sx", "", "e%sx", "", "", "", "r%sx"}; static const char * piFormats[9] = - {"", "%sl", "%s", "", "e%s", "", "", "", "r%s"}; + {"", "%s", "%s", "", "e%s", "", "", "", "r%s"}; static const char * longFormats[9] = {"", "r%sb", "r%sw", "", "r%sd", "", "", "", "r%s"}; static const char * microFormats[9] = {"", "t%db", "t%dw", "", "t%dd", "", "", "", "t%d"}; if (reg < FP_Base_DepTag) { + char * suffix = ""; + bool fold = reg & (1 << 6); + reg &= ~(1 << 6); + + if(fold) + { + suffix = "h"; + reg -= 4; + } + else if(reg < 8 && size == 1) + suffix = "l"; + switch (reg) { case INTREG_RAX: ccprintf(os, abcdFormats[size], "a"); @@ -178,6 +190,7 @@ namespace X86ISA default: ccprintf(os, microFormats[size], reg - NUM_INTREGS); } + ccprintf(os, suffix); } else if (reg < Ctrl_Base_DepTag) { ccprintf(os, "%%f%d", reg - FP_Base_DepTag); } else { diff --git a/src/arch/x86/insts/static_inst.hh b/src/arch/x86/insts/static_inst.hh index f42e6693d..22139fc77 100644 --- a/src/arch/x86/insts/static_inst.hh +++ b/src/arch/x86/insts/static_inst.hh @@ -92,9 +92,12 @@ namespace X86ISA inline uint64_t merge(uint64_t into, uint64_t val, int size) const { - X86IntReg reg; - reg = into; - //FIXME This needs to be handle high bytes as well + X86IntReg reg = into; + if(_destRegIdx[0] & (1 << 6)) + { + reg.H = val; + return reg; + } switch(size) { case 1: @@ -117,18 +120,20 @@ namespace X86ISA return reg; } - inline uint64_t pick(uint64_t from, int size) + inline uint64_t pick(uint64_t from, int idx, int size) const { - X86IntReg reg; - reg = from; + X86IntReg reg = from; + DPRINTF(X86, "Picking with size %d\n", size); + if(_srcRegIdx[idx] & (1 << 6)) + return reg.H; switch(size) { case 1: return reg.L; case 2: - return reg.E; - case 4: return reg.X; + case 4: + return reg.E; case 8: return reg.R; default: |