29#ifndef __ARCH_X86_DECODER_HH__
30#define __ARCH_X86_DECODER_HH__
33#include <unordered_map>
46#include "debug/Decoder.hh"
47#include "params/X86Decoder.hh"
134 int toGet = size - collected;
138 toGet = toGet > remaining ? remaining : toGet;
143 partialImm &=
mask(toGet * 8);
147 current |= partialImm;
158 DPRINTF(
Decoder,
"At the end of a chunk, idx = %d, chunks = %d.\n",
236 bool addrSizedImm =
false);
246 typedef std::unordered_map<
272 mode = (X86Mode)(uint64_t)m5Reg.mode;
283 InstCacheMap::iterator imIter =
instCacheMap.find(m5Reg);
327 offset = (fetchPC >=
pc.instAddr()) ? 0 :
pc.instAddr() - fetchPC;
336 if (!nextPC.
size()) {
339 "Calculating the instruction size: "
340 "basePC: %#x offset: %#x origPC: %#x size: %d\n",
343 nextPC.
npc(nextPC.
pc() + size);
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
virtual void takeOverFrom(InstDecoder *old)
Take over the state from an old decoder when switching CPUs.
InstDecoder(const InstDecoderParams ¶ms, MoreBytesType *mb_buf)
State doPrefixState(uint8_t)
std::unordered_map< CacheKey, decode_cache::InstMap< ExtMachInst > * > InstCacheMap
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr)
Decode a machine instruction.
static const ByteTable ImmediateTypeTwoByte
State processExtendedOpcode(ByteTable &immTable)
@ ThreeByte0F3AOpcodeState
@ ThreeByte0F38OpcodeState
void consumeBytes(int numBytes)
StaticInstPtr fetchRomMicroop(MicroPC micropc, StaticInstPtr curMacroop) override
State doThreeByte0F3AOpcodeState(uint8_t)
static const ByteTable UsesModRMTwoByte
void updateNPC(X86ISA::PCState &nextPC)
State doVex3Of3State(uint8_t)
decode_cache::InstMap< ExtMachInst > * instMap
static const ByteTable UsesModRMThreeByte0F3A
State doVexOpcodeState(uint8_t)
void takeOverFrom(InstDecoder *old) override
Take over the state from an old decoder when switching CPUs.
State doDisplacementState()
RegVal CacheKey
Caching for decoded instruction objects.
const uint8_t ByteTable[256]
State doVex2Of2State(uint8_t)
static const ByteTable ImmediateTypeThreeByte0F38
State doVex2Of3State(uint8_t)
Decoder(const X86DecoderParams &p)
void getImmediate(int &collected, uint64_t ¤t, int size)
State processOpcode(ByteTable &immTable, ByteTable &modrmTable, bool addrSizedImm=false)
static const ByteTable UsesModRMThreeByte0F38
StaticInstPtr decodeInst(ExtMachInst mach_inst)
State doOneByteOpcodeState(uint8_t)
static const uint8_t SizeTypeToSize[3][10]
static const ByteTable Prefixes[2]
InstCacheMap instCacheMap
State doTwoByteOpcodeState(uint8_t)
X86ISAInst::MicrocodeRom microcodeRom
void setM5Reg(HandyM5Reg m5Reg)
static const ByteTable ImmediateTypeThreeByte0F3A
State doThreeByte0F38OpcodeState(uint8_t)
static const ByteTable ImmediateTypeOneByte
State doSIBState(uint8_t)
State doModRMState(uint8_t)
void moreBytes(const PCStateBase &pc, Addr fetchPC) override
Feed data to the decoder.
static const ByteTable UsesModRMOneByte
This is exposed globally, independent of the ISA.
std::unordered_map< EMI, StaticInstPtr > InstMap
Hash for decoded instructions.
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
RefCountingPtr< StaticInst > StaticInstPtr
std::vector< MachInst > chunks
std::vector< MachInst > masks