37 #include "debug/Decoder.hh"
136 panic(
"Went to the error state in the decoder.\n");
180 uint8_t prefix =
Prefixes[nextByte];
239 panic(
"Unrecognized prefix %#x\n", nextByte);
248 Vex2Of2 vex = nextByte;
283 nextByte >= 0xA0 && nextByte <= 0xA3);
287 Vex2Of3 vex = nextByte;
324 nextByte >= 0xA0 && nextByte <= 0xA3);
328 Vex3Of3 vex = nextByte;
362 case ThreeByte0F38Opcode:
365 case ThreeByte0F3AOpcode:
381 if (nextByte == 0x0f) {
390 nextByte >= 0xA0 && nextByte <= 0xA3);
402 if (nextByte == 0x38) {
405 }
else if (nextByte == 0x3a) {
425 DPRINTF(
Decoder,
"Found three byte 0F38 opcode %#x.\n", nextByte);
439 DPRINTF(
Decoder,
"Found three byte 0F3A opcode %#x.\n", nextByte);
485 int immType = immTable[
opcode];
492 if (modrmTable[opcode]) {
512 ModRM modRM = nextByte;
516 if ((modRM.mod == 0 && modRM.rm == 6) || modRM.mod == 2)
518 else if (modRM.mod == 1)
524 if ((modRM.mod == 0 && modRM.rm == 5) || modRM.mod == 2)
526 else if (modRM.mod == 1)
534 if (
emi.
opcode.
type == OneByteOpcode && (modRM.reg & 0x6) == 0) {
543 if (modRM.rm == 4 && modRM.mod != 3) {
594 DPRINTF(
Decoder,
"Collecting %d byte displacement, got %d bytes.\n",
613 panic(
"Undefined displacement size!\n");
683 DecodeCache::InstMap::iterator iter =
instMap->find(mach_inst);
688 (*instMap)[mach_inst] =
si;
706 const int chunkSize =
sizeof(
MachInst);
714 int start = firstOffset;
718 int end = start + totalSize;
719 end = (chunkSize < end) ? chunkSize : end;
720 int size = end - start;
struct X86ISA::ExtMachInst::@25 opcode
static ByteTable UsesModRMThreeByte0F38
State doVex3Of3State(uint8_t)
State doVex2Of3State(uint8_t)
State doTwoByteOpcodeState(uint8_t)
static const uint8_t SizeTypeToSize[3][10]
Value & lookup(Addr addr)
State doPrefixState(uint8_t)
StaticInstPtr decodeInst(ExtMachInst mach_inst)
State doSIBState(uint8_t)
static ByteTable ImmediateTypeThreeByte0F3A
static ByteTable UsesModRMOneByte
DecodePages * decodePages
static ByteTable UsesModRMTwoByte
static InstCacheMap instCacheMap
LegacyPrefixVector legacy
State processOpcode(ByteTable &immTable, ByteTable &modrmTable, bool addrSizedImm=false)
State doVexOpcodeState(uint8_t)
std::unordered_map< CacheKey, DecodeCache::InstMap * > InstCacheMap
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.
static ByteTable ImmediateTypeOneByte
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr)
Decode a machine instruction.
State doVex2Of2State(uint8_t)
State doModRMState(uint8_t)
std::vector< MachInst > masks
Bitfield< 24, 21 > opcode
State doDisplacementState()
State doOneByteOpcodeState(uint8_t)
State doThreeByte0F38OpcodeState(uint8_t)
DecodeCache::InstMap * instMap
static ByteTable ImmediateTypeThreeByte0F38
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
void updateNPC(X86ISA::PCState &nextPC)
std::vector< MachInst > chunks
State doThreeByte0F3AOpcodeState(uint8_t)
static ByteTable UsesModRMThreeByte0F3A
void getImmediate(int &collected, uint64_t ¤t, int size)