31 #ifndef __ARCH_X86_DECODER_HH__
32 #define __ARCH_X86_DECODER_HH__
35 #include <unordered_map>
46 #include "debug/Decoder.hh"
115 int toGet = size - collected;
119 toGet = toGet > remaining ? remaining : toGet;
124 partialImm &=
mask(toGet * 8);
128 current |= partialImm;
138 DPRINTF(
Decoder,
"At the end of a chunk, idx = %d, chunks = %d.\n",
218 bool addrSizedImm =
false);
233 typedef std::unordered_map<CacheKey, DecodeCache::InstMap *>
InstCacheMap;
241 memset(&
emi, 0,
sizeof(
emi));
258 mode = (X86Mode)(uint64_t)m5Reg.mode;
268 AddrCacheMap::iterator amIter =
addrCacheMap.find(m5Reg);
276 InstCacheMap::iterator imIter =
instCacheMap.find(m5Reg);
330 if (!nextPC.
size()) {
333 "Calculating the instruction size: "
334 "basePC: %#x offset: %#x origPC: %#x size: %d\n",
353 #endif // __ARCH_X86_DECODER_HH__
static ByteTable UsesModRMThreeByte0F38
State doVex3Of3State(uint8_t)
State doVex2Of3State(uint8_t)
static ByteTable Prefixes
MiscReg CacheKey
Caching for decoded instruction objects.
void moreBytes(const PCState &pc, Addr fetchPC, MachInst data)
State doTwoByteOpcodeState(uint8_t)
static ByteTable ImmediateTypeVex[10]
static const uint8_t SizeTypeToSize[3][10]
std::unordered_map< CacheKey, DecodePages * > AddrCacheMap
State doPrefixState(uint8_t)
StaticInstPtr decodeInst(ExtMachInst mach_inst)
Addr instAddr() const
Returns the memory address the bytes of this instruction came from.
State doSIBState(uint8_t)
static ByteTable ImmediateTypeThreeByte0F3A
static ByteTable UsesModRMOneByte
DecodePages * decodePages
static ByteTable UsesModRMTwoByte
static InstCacheMap instCacheMap
std::unordered_map< TheISA::ExtMachInst, StaticInstPtr > InstMap
Hash for decoded instructions.
State processOpcode(ByteTable &immTable, ByteTable &modrmTable, bool addrSizedImm=false)
void consumeBytes(int numBytes)
State doVexOpcodeState(uint8_t)
std::unordered_map< CacheKey, DecodeCache::InstMap * > InstCacheMap
void setM5Reg(HandyM5Reg m5Reg)
static ByteTable ImmediateTypeTwoByte
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
AddrCacheMap addrCacheMap
static ByteTable ImmediateTypeOneByte
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr)
Decode a machine instruction.
A sparse map from an Addr to a Value, stored in page chunks.
DecodeCache::AddrMap< Decoder::InstBytes > DecodePages
State doVex2Of2State(uint8_t)
State doModRMState(uint8_t)
Decoder(ISA *isa=nullptr)
std::vector< MachInst > masks
State doDisplacementState()
State doOneByteOpcodeState(uint8_t)
State doThreeByte0F38OpcodeState(uint8_t)
const uint8_t ByteTable[256]
DecodeCache::InstMap * instMap
static ByteTable ImmediateTypeThreeByte0F38
void takeOverFrom(Decoder *old)
void updateNPC(X86ISA::PCState &nextPC)
std::vector< MachInst > chunks
State doThreeByte0F3AOpcodeState(uint8_t)
State processExtendedOpcode(ByteTable &immTable)
static ByteTable UsesModRMThreeByte0F3A
void getImmediate(int &collected, uint64_t ¤t, int size)