summaryrefslogtreecommitdiff
path: root/src/arch/x86/insts/static_inst.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-01-06 22:46:28 -0800
committerGabe Black <gblack@eecs.umich.edu>2009-01-06 22:46:28 -0800
commit8cab1805f9854d74b4a73c5c3b316aa7ad2d2177 (patch)
tree798104ee42fc5a92d5a740b779a03fd99e908dd8 /src/arch/x86/insts/static_inst.cc
parent9e24d8c599a3090f3ce59a608ff887ac434aa1ca (diff)
downloadgem5-8cab1805f9854d74b4a73c5c3b316aa7ad2d2177.tar.xz
X86: Move the function that prints memory args into the inst base class.
Diffstat (limited to 'src/arch/x86/insts/static_inst.cc')
-rw-r--r--src/arch/x86/insts/static_inst.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/arch/x86/insts/static_inst.cc b/src/arch/x86/insts/static_inst.cc
index 15fc4bee6..f4ed44603 100644
--- a/src/arch/x86/insts/static_inst.cc
+++ b/src/arch/x86/insts/static_inst.cc
@@ -240,6 +240,44 @@ namespace X86ISA
}
}
+ void X86StaticInst::printMem(std::ostream &os, uint8_t segment,
+ uint8_t scale, RegIndex index, RegIndex base,
+ uint64_t disp, uint8_t addressSize, bool rip) const
+ {
+ bool someAddr = false;
+ printSegment(os, segment);
+ os << ":[";
+ if (rip) {
+ os << "rip";
+ someAddr = true;
+ } else {
+ if (scale != 0 && index != ZeroReg)
+ {
+ if(scale != 1)
+ ccprintf(os, "%d*", scale);
+ printReg(os, index, addressSize);
+ someAddr = true;
+ }
+ if (base != ZeroReg)
+ {
+ if(someAddr)
+ os << " + ";
+ printReg(os, base, addressSize);
+ someAddr = true;
+ }
+ }
+ if (disp != 0)
+ {
+ if(someAddr)
+ os << " + ";
+ ccprintf(os, "%#x", disp);
+ someAddr = true;
+ }
+ if (!someAddr)
+ os << "0";
+ os << "]";
+ }
+
std::string X86StaticInst::generateDisassembly(Addr pc,
const SymbolTable *symtab) const
{