summaryrefslogtreecommitdiff
path: root/src/arch/x86/predecoder.hh
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-05-31 13:50:35 +0000
committerGabe Black <gblack@eecs.umich.edu>2007-05-31 13:50:35 +0000
commit7860c045e2a87a4e63b7d542a63a30da934ac6dd (patch)
tree2f7f45224c4a1dcaa2230f0d7acc229b269fba65 /src/arch/x86/predecoder.hh
parenta3ae9486d543f23cd4203381e7bcf2ce86c51389 (diff)
downloadgem5-7860c045e2a87a4e63b7d542a63a30da934ac6dd.tar.xz
x86 work that hadn't been checked in.
src/arch/x86/isa/decoder/one_byte_opcodes.isa: Give the "MOV" instruction the format of it's arguments. This will likely need to be completely overhauled in the near future. src/arch/x86/predecoder.cc: src/arch/x86/predecoder.hh: Make the predecoder explicitly reset itself rather than counting on it happening naturally. src/arch/x86/predecoder_tables.cc: Fix the immediate size table src/arch/x86/regfile.cc: nextnpc is bogus --HG-- extra : convert_revision : 0926701fedaab41817e64bb05410a25174484a5a
Diffstat (limited to 'src/arch/x86/predecoder.hh')
-rw-r--r--src/arch/x86/predecoder.hh20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/arch/x86/predecoder.hh b/src/arch/x86/predecoder.hh
index 6562ab9f5..9b4d36d4a 100644
--- a/src/arch/x86/predecoder.hh
+++ b/src/arch/x86/predecoder.hh
@@ -60,6 +60,8 @@
#include "arch/x86/types.hh"
#include "base/bitfield.hh"
+#include "base/misc.hh"
+#include "base/trace.hh"
#include "sim/host.hh"
class ThreadContext;
@@ -81,6 +83,8 @@ namespace X86ISA
MachInst fetchChunk;
//The pc of the start of fetchChunk
Addr basePC;
+ //The pc the current instruction started at
+ Addr origPC;
//The offset into fetchChunk of current processing
int offset;
//The extended machine instruction being generated
@@ -130,6 +134,8 @@ namespace X86ISA
outOfBytes = true;
}
+ void reset();
+
//State machine state
protected:
//Whether or not we're out of bytes
@@ -144,6 +150,7 @@ namespace X86ISA
int immediateCollected;
enum State {
+ ResetState,
PrefixState,
OpcodeState,
ModRMState,
@@ -166,9 +173,9 @@ namespace X86ISA
public:
Predecoder(ThreadContext * _tc) :
- tc(_tc), basePC(0), offset(0),
+ tc(_tc), basePC(0), origPC(0), offset(0),
outOfBytes(true), emiIsReady(false),
- state(PrefixState)
+ state(ResetState)
{}
ThreadContext * getTC()
@@ -219,6 +226,15 @@ namespace X86ISA
emiIsReady = false;
return emi;
}
+
+ int getInstSize()
+ {
+ DPRINTF(Predecoder,
+ "Calculating the instruction size: "
+ "basePC: %#x offset: %#x origPC: %#x\n",
+ basePC, offset, origPC);
+ return basePC + offset - origPC;
+ }
};
};