Go to the documentation of this file.
29 #ifndef __ARCH_X86_DECODER_HH__
30 #define __ARCH_X86_DECODER_HH__
33 #include <unordered_map>
46 #include "debug/Decoder.hh"
119 int toGet = size - collected;
123 toGet = toGet > remaining ? remaining : toGet;
128 partialImm &=
mask(toGet * 8);
132 current |= partialImm;
143 DPRINTF(
Decoder,
"At the end of a chunk, idx = %d, chunks = %d.\n",
225 bool addrSizedImm =
false);
240 typedef std::unordered_map<
255 mode = (X86Mode)(uint64_t)m5Reg.mode;
265 AddrCacheMap::iterator amIter =
addrCacheMap.find(m5Reg);
273 InstCacheMap::iterator imIter =
instCacheMap.find(m5Reg);
307 offset = (fetchPC >=
pc.instAddr()) ? 0 :
pc.instAddr() - fetchPC;
319 if (!nextPC.
size()) {
322 "Calculating the instruction size: "
323 "basePC: %#x offset: %#x origPC: %#x size: %d\n",
326 nextPC.
npc(nextPC.
pc() + size);
345 #endif // __ARCH_X86_DECODER_HH__
static ByteTable UsesModRMThreeByte0F38
void updateNPC(X86ISA::PCState &nextPC)
std::vector< MachInst > chunks
static const uint8_t SizeTypeToSize[3][10]
static ByteTable Prefixes
void getImmediate(int &collected, uint64_t ¤t, int size)
static ByteTable ImmediateTypeVex[10]
static ByteTable UsesModRMThreeByte0F3A
@ ThreeByte0F3AOpcodeState
State doVex2Of3State(uint8_t)
std::unordered_map< CacheKey, DecodePages * > AddrCacheMap
State doPrefixState(uint8_t)
StaticInstPtr decodeInst(ExtMachInst mach_inst)
A sparse map from an Addr to a Value, stored in page chunks.
State doVex3Of3State(uint8_t)
State doTwoByteOpcodeState(uint8_t)
static ByteTable UsesModRMTwoByte
void moreBytes(const PCState &pc, Addr fetchPC, MachInst data)
State doSIBState(uint8_t)
static ByteTable ImmediateTypeThreeByte0F3A
const typedef uint8_t ByteTable[256]
static ByteTable ImmediateTypeTwoByte
void consumeBytes(int numBytes)
std::unordered_map< EMI, StaticInstPtr > InstMap
Hash for decoded instructions.
State processOpcode(ByteTable &immTable, ByteTable &modrmTable, bool addrSizedImm=false)
State doModRMState(uint8_t)
static ByteTable UsesModRMOneByte
State doVexOpcodeState(uint8_t)
Decoder(ISA *isa=nullptr)
DecodePages * decodePages
StaticInstPtr fetchRomMicroop(MicroPC micropc, StaticInstPtr curMacroop) override
void setM5Reg(HandyM5Reg m5Reg)
This is exposed globally, independent of the ISA.
static InstCacheMap instCacheMap
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static ByteTable ImmediateTypeOneByte
State doThreeByte0F38OpcodeState(uint8_t)
@ ThreeByte0F38OpcodeState
AddrCacheMap addrCacheMap
static ByteTable ImmediateTypeThreeByte0F38
State doVex2Of2State(uint8_t)
DecodeCache::AddrMap< Decoder::InstBytes > DecodePages
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr)
Decode a machine instruction.
std::vector< MachInst > masks
std::unordered_map< CacheKey, DecodeCache::InstMap< ExtMachInst > * > InstCacheMap
void takeOverFrom(Decoder *old)
DecodeCache::InstMap< ExtMachInst > * instMap
State doOneByteOpcodeState(uint8_t)
State doDisplacementState()
State doThreeByte0F3AOpcodeState(uint8_t)
static X86ISAInst::MicrocodeRom microcodeRom
RegVal CacheKey
Caching for decoded instruction objects.
State processExtendedOpcode(ByteTable &immTable)
Generated on Wed Sep 30 2020 14:01:58 for gem5 by doxygen 1.8.17