#include "cpustate.hpp" #include #include #define PRINT_REGISTER(NAME, FNAME) #NAME": 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.FNAME() << std::endl std::ostream&operator<<(std::ostream& os, CpuState& cpu) { os << PRINT_REGISTER(EIP, eip) << PRINT_REGISTER(EAX, eax) << PRINT_REGISTER(EBX, ebx) << PRINT_REGISTER(ECX, ecx) << PRINT_REGISTER(EDX, edx) << PRINT_REGISTER(ESP, esp) << PRINT_REGISTER(EBP, ebp) << PRINT_REGISTER(ESI, esi) << PRINT_REGISTER(EDI, edi) << PRINT_REGISTER( CS, cs) << PRINT_REGISTER( DS, ds) << PRINT_REGISTER( ES, es) << PRINT_REGISTER( SS, ss) << PRINT_REGISTER( FS, fs) << PRINT_REGISTER( GS, gs) << "cf \tpf \taf \tzf \tsf \ttf \tintf \tdf" << std::endl << cpu.cf() << "\t" << cpu.pf() << "\t" << cpu.af() << "\t" << cpu.zf() << "\t" << cpu.sf() << "\t" << cpu.tf() << "\t" << cpu.intf() << "\t" << cpu.df() << std::endl << std::endl << "of \tnt \trf \tvm \tac \tvif \tvip \tid" << std::endl << cpu.of() << "\t" << cpu.nt() << "\t" << cpu.rf() << "\t" << cpu.vm() << "\t" << cpu.ac() << "\t" << cpu.vif() << "\t" << cpu.vip() << "\t" << cpu.id() << std::endl; return os; } #undef PRINT_REGISTER