35#include "debug/Decode.hh"
36#include "debug/Decoder.hh"
138 panic(
"Went to the error state in the decoder.\n");
185 const uint8_t prefix =
Prefixes[table_idx][nextByte];
240 panic(
"Unrecognized prefix %#x\n", nextByte);
249 Vex2Of2 vex = nextByte;
284 nextByte >= 0xA0 && nextByte <= 0xA3);
288 Vex2Of3 vex = nextByte;
325 nextByte >= 0xA0 && nextByte <= 0xA3);
329 Vex3Of3 vex = nextByte;
364 case ThreeByte0F38Opcode:
367 case ThreeByte0F3AOpcode:
383 if (nextByte == 0x0f) {
392 nextByte >= 0xA0 && nextByte <= 0xA3);
404 if (nextByte == 0x38) {
407 }
else if (nextByte == 0x3a) {
427 DPRINTF(
Decoder,
"Found three byte 0F38 opcode %#x.\n", nextByte);
441 DPRINTF(
Decoder,
"Found three byte 0F3A opcode %#x.\n", nextByte);
487 int immType = immTable[
opcode];
514 ModRM modRM = nextByte;
518 if ((modRM.mod == 0 && modRM.rm == 6) || modRM.mod == 2)
520 else if (modRM.mod == 1)
526 if ((modRM.mod == 0 && modRM.rm == 5) || modRM.mod == 2)
528 else if (modRM.mod == 1)
536 if (
emi.
opcode.
type == OneByteOpcode && (modRM.reg & 0x6) == 0) {
545 if (modRM.rm == 4 && modRM.mod != 3 &&
emi.
addrSize != 2) {
594 DPRINTF(
Decoder,
"Collecting %d byte displacement, got %d bytes.\n",
613 panic(
"Undefined displacement size!\n");
677 auto iter =
instMap->find(mach_inst);
682 (*instMap)[mach_inst] =
si;
687 DPRINTF(Decode,
"Decode: Decoded %s instruction: %#x\n",
688 si->getName(), mach_inst);
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;
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
StaticInstPtr fetchMicroop(MicroPC microPC, StaticInstPtr curMacroop)
State doPrefixState(uint8_t)
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr)
Decode a machine instruction.
static const ByteTable ImmediateTypeTwoByte
@ ThreeByte0F3AOpcodeState
@ ThreeByte0F38OpcodeState
DecodePages * decodePages
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)
State doDisplacementState()
State doVex2Of2State(uint8_t)
static const ByteTable ImmediateTypeThreeByte0F38
State doVex2Of3State(uint8_t)
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]
State doTwoByteOpcodeState(uint8_t)
X86ISAInst::MicrocodeRom microcodeRom
static const ByteTable ImmediateTypeThreeByte0F3A
State doThreeByte0F38OpcodeState(uint8_t)
static const ByteTable ImmediateTypeOneByte
State doSIBState(uint8_t)
State doModRMState(uint8_t)
static const ByteTable UsesModRMOneByte
Value & lookup(Addr addr)
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define panic(...)
This implements a cprintf based panic() function.
Bitfield< 24, 21 > opcode
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
std::vector< MachInst > chunks
std::vector< MachInst > masks
struct gem5::X86ISA::ExtMachInst::@42 opcode
LegacyPrefixVector legacy