namespace X86ISA
{
- namespace ConditionTests
+
+namespace ConditionTests
+{
+
+enum CondTest
+{
+ True,
+ NotFalse = True,
+ ECF,
+ EZF,
+ SZnZF,
+ MSTRZ,
+ STRZ,
+ MSTRC,
+ STRZnEZF,
+ OF,
+ CF,
+ ZF,
+ CvZF,
+ SF,
+ PF,
+ SxOF,
+ SxOvZF,
+
+ False,
+ NotTrue = False,
+ NotECF,
+ NotEZF,
+ NotSZnZF,
+ NotMSTRZ,
+ NotSTRZ,
+ NotMSTRC,
+ STRnZnEZF,
+ NotOF,
+ NotCF,
+ NotZF,
+ NotCvZF,
+ NotSF,
+ NotPF,
+ NotSxOF,
+ NotSxOvZF
+};
+
+}
+
+//A class which is the base of all x86 micro ops. It provides a function to
+//set necessary flags appropriately.
+class X86MicroopBase : public X86StaticInst
+{
+ protected:
+ const char * instMnem;
+ uint8_t opSize;
+ uint8_t addrSize;
+
+ X86MicroopBase(ExtMachInst _machInst,
+ const char *mnem, const char *_instMnem,
+ uint64_t setFlags, OpClass __opClass) :
+ X86ISA::X86StaticInst(mnem, _machInst, __opClass),
+ instMnem(_instMnem)
{
- enum CondTest {
- True,
- NotFalse = True,
- ECF,
- EZF,
- SZnZF,
- MSTRZ,
- STRZ,
- MSTRC,
- STRZnEZF,
- OF,
- CF,
- ZF,
- CvZF,
- SF,
- PF,
- SxOF,
- SxOvZF,
-
- False,
- NotTrue = False,
- NotECF,
- NotEZF,
- NotSZnZF,
- NotMSTRZ,
- NotSTRZ,
- NotMSTRC,
- STRnZnEZF,
- NotOF,
- NotCF,
- NotZF,
- NotCvZF,
- NotSF,
- NotPF,
- NotSxOF,
- NotSxOvZF
- };
+ const int ChunkSize = sizeof(unsigned long);
+ const int Chunks = sizeof(setFlags) / ChunkSize;
+
+ // Since the bitset constructor can only handle unsigned long
+ // sized chunks, feed it those one at a time while oring them in.
+ for (int i = 0; i < Chunks; i++) {
+ unsigned shift = i * ChunkSize * 8;
+ flags |= (std::bitset<Num_Flags>(setFlags >> shift) << shift);
+ }
}
- //A class which is the base of all x86 micro ops. It provides a function to
- //set necessary flags appropriately.
- class X86MicroopBase : public X86StaticInst
+ std::string
+ generateDisassembly(Addr pc,
+ const Loader::SymbolTable *symtab) const override
{
- protected:
- const char * instMnem;
- uint8_t opSize;
- uint8_t addrSize;
-
- X86MicroopBase(ExtMachInst _machInst,
- const char *mnem, const char *_instMnem,
- uint64_t setFlags, OpClass __opClass) :
- X86ISA::X86StaticInst(mnem, _machInst, __opClass),
- instMnem(_instMnem)
- {
- const int ChunkSize = sizeof(unsigned long);
- const int Chunks = sizeof(setFlags) / ChunkSize;
-
- // Since the bitset constructor can only handle unsigned long
- // sized chunks, feed it those one at a time while oring them in.
- for (int i = 0; i < Chunks; i++) {
- unsigned shift = i * ChunkSize * 8;
- flags |= (std::bitset<Num_Flags>(setFlags >> shift) << shift);
- }
- }
+ std::stringstream ss;
- std::string
- generateDisassembly(Addr pc,
- const Loader::SymbolTable *symtab) const override
- {
- std::stringstream ss;
+ ccprintf(ss, "\t%s.%s", instMnem, mnemonic);
- ccprintf(ss, "\t%s.%s", instMnem, mnemonic);
+ return ss.str();
+ }
- return ss.str();
- }
+ bool checkCondition(uint64_t flags, int condition) const;
- bool checkCondition(uint64_t flags, int condition) const;
+ void
+ advancePC(PCState &pcState) const override
+ {
+ if (flags[IsLastMicroop])
+ pcState.uEnd();
+ else
+ pcState.uAdvance();
+ }
+};
- void
- advancePC(PCState &pcState) const override
- {
- if (flags[IsLastMicroop])
- pcState.uEnd();
- else
- pcState.uAdvance();
- }
- };
}
#endif //__ARCH_X86_INSTS_MICROOP_HH__