summaryrefslogtreecommitdiff
path: root/src/arch/x86/isa/base.isa
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/isa/base.isa')
-rw-r--r--src/arch/x86/isa/base.isa58
1 files changed, 57 insertions, 1 deletions
diff --git a/src/arch/x86/isa/base.isa b/src/arch/x86/isa/base.isa
index eba24f709..d9bd87f2d 100644
--- a/src/arch/x86/isa/base.isa
+++ b/src/arch/x86/isa/base.isa
@@ -95,6 +95,14 @@ output header {{
/**
* Base class for all X86 static instructions.
*/
+ BitUnion64(X86IntReg)
+ Bitfield<63,0> R;
+ Bitfield<31,0> E;
+ Bitfield<15,0> X;
+ Bitfield<15,8> H;
+ Bitfield<7, 0> L;
+ EndBitUnion(X86IntReg)
+
class X86StaticInst : public StaticInst
{
protected:
@@ -114,10 +122,50 @@ output header {{
inline uint64_t merge(uint64_t into, uint64_t val, int size) const
{
- //FIXME This needs to be significantly more sophisticated
+ X86IntReg reg;
+ reg = into;
+ //FIXME This needs to be handle high bytes as well
+ switch(size)
+ {
+ case 1:
+ reg.L = val;
+ break;
+ case 2:
+ reg.X = val;
+ break;
+ case 4:
+ //XXX Check if this should be zeroed or sign extended
+ reg = 0;
+ reg.E = val;
+ break;
+ case 8:
+ reg.R = val;
+ break;
+ default:
+ panic("Tried to merge with unrecognized size %d.\n", size);
+ }
return val;
}
+ inline uint64_t pick(uint64_t from, int size)
+ {
+ X86IntReg reg;
+ reg = from;
+ switch(size)
+ {
+ case 1:
+ return reg.L;
+ case 2:
+ return reg.E;
+ case 4:
+ return reg.X;
+ case 8:
+ return reg.R;
+ default:
+ panic("Tried to pick with unrecognized size %d.\n", size);
+ }
+ }
+
};
}};
@@ -128,6 +176,12 @@ output decoder {{
ccprintf(os, "\t%s ", mnemonic);
}
+ inline void printMnemonic(std::ostream &os,
+ const char * instMnemonic, const char * mnemonic)
+ {
+ ccprintf(os, "\t%s : %s ", instMnemonic, mnemonic);
+ }
+
void
X86StaticInst::printSrcReg(std::ostream &os, int reg) const
{
@@ -197,6 +251,8 @@ output decoder {{
case INTREG_R15W:
ccprintf(os, "r15");
break;
+ default:
+ ccprintf(os, "t%d", reg - NUM_INTREGS);
}
} else if (reg < Ctrl_Base_DepTag) {
ccprintf(os, "%%f%d", reg - FP_Base_DepTag);