1
0
Fork 0

last ymm support

This commit is contained in:
dreg_fr33project 2014-11-11 09:14:25 +01:00
parent 676942ed80
commit 4c38c7c348
8 changed files with 137 additions and 3 deletions

View File

@ -481,8 +481,10 @@ typedef struct
DWORD MxCsr; DWORD MxCsr;
#ifdef _WIN64 #ifdef _WIN64
M128A XmmRegisters[16]; M128A XmmRegisters[16];
BYTE YmmRegisters[32 * 16];
#else // x86 #else // x86
M128A XmmRegisters[8]; M128A XmmRegisters[8];
BYTE YmmRegisters[32 * 8];
#endif #endif
} REGISTERCONTEXT; } REGISTERCONTEXT;

View File

@ -297,7 +297,22 @@
#define UE_x87_ST5 84 #define UE_x87_ST5 84
#define UE_x87_ST6 85 #define UE_x87_ST6 85
#define UE_x87_ST7 86 #define UE_x87_ST7 86
#define UE_YMM0 87
#define UE_YMM1 88
#define UE_YMM2 89
#define UE_YMM3 90
#define UE_YMM4 91
#define UE_YMM5 92
#define UE_YMM6 93
#define UE_YMM7 94
#define UE_YMM8 95
#define UE_YMM9 96
#define UE_YMM10 97
#define UE_YMM11 98
#define UE_YMM12 99
#define UE_YMM13 100
#define UE_YMM14 101
#define UE_YMM15 102
#ifndef CONTEXT_EXTENDED_REGISTERS #ifndef CONTEXT_EXTENDED_REGISTERS
#define CONTEXT_EXTENDED_REGISTERS 0 #define CONTEXT_EXTENDED_REGISTERS 0
@ -361,8 +376,10 @@ typedef struct
DWORD MxCsr; DWORD MxCsr;
#ifdef _WIN64 #ifdef _WIN64
M128A XmmRegisters[16]; M128A XmmRegisters[16];
BYTE YmmRegisters[32 * 16];
#else // x86 #else // x86
M128A XmmRegisters[8]; M128A XmmRegisters[8];
BYTE YmmRegisters[32 * 8];
#endif #endif
} TITAN_ENGINE_CONTEXT_t; } TITAN_ENGINE_CONTEXT_t;
@ -817,6 +834,7 @@ __declspec(dllexport) ULONG_PTR TITCALL GetContextData(DWORD IndexOfRegister);
__declspec(dllexport) bool TITCALL SetContextFPUDataEx(HANDLE hActiveThread, void* FPUSaveArea); __declspec(dllexport) bool TITCALL SetContextFPUDataEx(HANDLE hActiveThread, void* FPUSaveArea);
__declspec(dllexport) bool TITCALL SetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister, ULONG_PTR NewRegisterValue); __declspec(dllexport) bool TITCALL SetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister, ULONG_PTR NewRegisterValue);
__declspec(dllexport) bool TITCALL SetContextData(DWORD IndexOfRegister, ULONG_PTR NewRegisterValue); __declspec(dllexport) bool TITCALL SetContextData(DWORD IndexOfRegister, ULONG_PTR NewRegisterValue);
__declspec(dllexport) bool TITCALL GetAVXContext(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext);
__declspec(dllexport) void TITCALL ClearExceptionNumber(); __declspec(dllexport) void TITCALL ClearExceptionNumber();
__declspec(dllexport) long TITCALL CurrentExceptionNumber(); __declspec(dllexport) long TITCALL CurrentExceptionNumber();
__declspec(dllexport) bool TITCALL MatchPatternEx(HANDLE hProcess, void* MemoryToCheck, int SizeOfMemoryToCheck, void* PatternToMatch, int SizeOfPatternToMatch, PBYTE WildCard); __declspec(dllexport) bool TITCALL MatchPatternEx(HANDLE hProcess, void* MemoryToCheck, int SizeOfMemoryToCheck, void* PatternToMatch, int SizeOfPatternToMatch, PBYTE WildCard);

View File

@ -437,6 +437,7 @@ static void TranslateTitanContextToRegContext(const TITAN_ENGINE_CONTEXT_t* titc
TranslateTitanFpu(&titcontext->x87fpu, &regcontext->x87fpu); TranslateTitanFpu(&titcontext->x87fpu, &regcontext->x87fpu);
regcontext->MxCsr = titcontext->MxCsr; regcontext->MxCsr = titcontext->MxCsr;
memcpy(regcontext->XmmRegisters, titcontext->XmmRegisters, sizeof(regcontext->XmmRegisters)); memcpy(regcontext->XmmRegisters, titcontext->XmmRegisters, sizeof(regcontext->XmmRegisters));
memcpy(regcontext->YmmRegisters, titcontext->YmmRegisters, sizeof(regcontext->YmmRegisters));
} }
static void TranslateTitanFpuRegister(const x87FPURegister_t* titanReg, X87FPUREGISTER* reg) static void TranslateTitanFpuRegister(const x87FPURegister_t* titanReg, X87FPUREGISTER* reg)

View File

@ -33,7 +33,7 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
mGeneralRegs = new RegistersView(0); mGeneralRegs = new RegistersView(0);
mGeneralRegs->setFixedWidth(1000); mGeneralRegs->setFixedWidth(1000);
mGeneralRegs->setFixedHeight(1200); mGeneralRegs->setFixedHeight(1400);
mGeneralRegs->ShowFPU(true); mGeneralRegs->ShowFPU(true);
QScrollArea* scrollArea = new QScrollArea; QScrollArea* scrollArea = new QScrollArea;

View File

@ -346,6 +346,44 @@ void RegistersView::InitMappings()
offset++; offset++;
mRegisterMapping.insert(YMM0, "YMM0");
mRegisterPlaces.insert(YMM0, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM1, "YMM1");
mRegisterPlaces.insert(YMM1, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM2, "YMM2");
mRegisterPlaces.insert(YMM2, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM3, "YMM3");
mRegisterPlaces.insert(YMM3, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM4, "YMM4");
mRegisterPlaces.insert(YMM4, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM5, "YMM5");
mRegisterPlaces.insert(YMM5, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM6, "YMM6");
mRegisterPlaces.insert(YMM6, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM7, "YMM7");
mRegisterPlaces.insert(YMM7, Register_Position(offset++, 0, 6, 32 * 2));
#ifdef _WIN64
mRegisterMapping.insert(YMM8, "YMM8");
mRegisterPlaces.insert(YMM8, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM9, "YMM9");
mRegisterPlaces.insert(YMM9, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM10, "YMM10");
mRegisterPlaces.insert(YMM10, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM11, "YMM11");
mRegisterPlaces.insert(YMM11, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM12, "YMM12");
mRegisterPlaces.insert(YMM12, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM13, "YMM13");
mRegisterPlaces.insert(YMM13, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM14, "YMM14");
mRegisterPlaces.insert(YMM14, Register_Position(offset++, 0, 6, 32 * 2));
mRegisterMapping.insert(YMM15, "YMM15");
mRegisterPlaces.insert(YMM15, Register_Position(offset++, 0, 6, 32 * 2));
#endif
offset++;
mRegisterMapping.insert(DR0, "DR0"); mRegisterMapping.insert(DR0, "DR0");
mRegisterPlaces.insert(DR0, Register_Position(offset++, 0, 4, sizeof(uint_t) * 2)); mRegisterPlaces.insert(DR0, Register_Position(offset++, 0, 4, sizeof(uint_t) * 2));
mRegisterMapping.insert(DR1, "DR1"); mRegisterMapping.insert(DR1, "DR1");
@ -936,6 +974,57 @@ RegistersView::RegistersView(QWidget* parent) : QScrollArea(parent), mVScrollOff
mFPU.insert(XMM15); mFPU.insert(XMM15);
#endif #endif
mFPUYMM.insert(YMM0);
mMODIFYDISPLAY.insert(YMM0);
mFPU.insert(YMM0);
mFPUYMM.insert(YMM1);
mMODIFYDISPLAY.insert(YMM1);
mFPU.insert(YMM1);
mFPUYMM.insert(YMM2);
mMODIFYDISPLAY.insert(YMM2);
mFPU.insert(YMM2);
mFPUYMM.insert(YMM3);
mMODIFYDISPLAY.insert(YMM3);
mFPU.insert(YMM3);
mFPUYMM.insert(YMM4);
mMODIFYDISPLAY.insert(YMM4);
mFPU.insert(YMM4);
mFPUYMM.insert(YMM5);
mMODIFYDISPLAY.insert(YMM5);
mFPU.insert(YMM5);
mFPUYMM.insert(YMM6);
mMODIFYDISPLAY.insert(YMM6);
mFPU.insert(YMM6);
mFPUYMM.insert(YMM7);
mMODIFYDISPLAY.insert(YMM7);
mFPU.insert(YMM7);
#ifdef _WIN64
mFPUYMM.insert(YMM8);
mMODIFYDISPLAY.insert(YMM8);
mFPU.insert(YMM8);
mFPUYMM.insert(YMM9);
mMODIFYDISPLAY.insert(YMM9);
mFPU.insert(YMM9);
mFPUYMM.insert(YMM10);
mMODIFYDISPLAY.insert(YMM10);
mFPU.insert(YMM10);
mFPUYMM.insert(YMM11);
mMODIFYDISPLAY.insert(YMM11);
mFPU.insert(YMM11);
mFPUYMM.insert(YMM12);
mMODIFYDISPLAY.insert(YMM12);
mFPU.insert(YMM12);
mFPUYMM.insert(YMM13);
mMODIFYDISPLAY.insert(YMM13);
mFPU.insert(YMM13);
mFPUYMM.insert(YMM14);
mMODIFYDISPLAY.insert(YMM14);
mFPU.insert(YMM14);
mFPUYMM.insert(YMM15);
mMODIFYDISPLAY.insert(YMM15);
mFPU.insert(YMM15);
#endif
//registers that should not be changed //registers that should not be changed
mNoChange.insert(GS); mNoChange.insert(GS);
mUSHORTDISPLAY.insert(GS); mUSHORTDISPLAY.insert(GS);
@ -1807,7 +1896,7 @@ void RegistersView::displayEditDialog()
fpuvalue = (uint_t) mLineEdit.editText.toUShort(&ok, 16); fpuvalue = (uint_t) mLineEdit.editText.toUShort(&ok, 16);
else if(mDWORDDISPLAY.contains(mSelected)) else if(mDWORDDISPLAY.contains(mSelected))
fpuvalue = mLineEdit.editText.toUInt(&ok, 16); fpuvalue = mLineEdit.editText.toUInt(&ok, 16);
else if(mFPUMMX.contains(mSelected) || mFPUXMM.contains(mSelected) || mFPUx87_80BITSDISPLAY.contains(mSelected)) else if(mFPUMMX.contains(mSelected) || mFPUXMM.contains(mSelected) || mFPUYMM.contains(mSelected) || mFPUx87_80BITSDISPLAY.contains(mSelected))
{ {
QByteArray pArray = mLineEdit.editText.toLocal8Bit(); QByteArray pArray = mLineEdit.editText.toLocal8Bit();
if(pArray.size() == GetSizeRegister(mSelected) * 2) if(pArray.size() == GetSizeRegister(mSelected) * 2)
@ -2121,6 +2210,8 @@ SIZE_T RegistersView::GetSizeRegister(const REGISTER_NAME reg_name)
size = 8; size = 8;
else if(mFPUXMM.contains(reg_name)) else if(mFPUXMM.contains(reg_name))
size = 16; size = 16;
else if(mFPUYMM.contains(reg_name))
size = 32;
else else
size = 0; size = 0;
@ -2285,6 +2376,23 @@ char* RegistersView::registerValue(const REGDUMP* regd, const REGISTER_NAME reg)
if(reg == XMM14) return (char*) & (regd->regcontext.XmmRegisters[14]); if(reg == XMM14) return (char*) & (regd->regcontext.XmmRegisters[14]);
if(reg == XMM15) return (char*) & (regd->regcontext.XmmRegisters[15]); if(reg == XMM15) return (char*) & (regd->regcontext.XmmRegisters[15]);
if(reg == YMM0) return (char*) & (regd->regcontext.YmmRegisters[32 * 0]);
if(reg == YMM1) return (char*) & (regd->regcontext.YmmRegisters[32 * 1]);
if(reg == YMM2) return (char*) & (regd->regcontext.YmmRegisters[32 * 2]);
if(reg == YMM3) return (char*) & (regd->regcontext.YmmRegisters[32 * 3]);
if(reg == YMM4) return (char*) & (regd->regcontext.YmmRegisters[32 * 4]);
if(reg == YMM5) return (char*) & (regd->regcontext.YmmRegisters[32 * 5]);
if(reg == YMM6) return (char*) & (regd->regcontext.YmmRegisters[32 * 6]);
if(reg == YMM7) return (char*) & (regd->regcontext.YmmRegisters[32 * 7]);
if(reg == YMM8) return (char*) & (regd->regcontext.YmmRegisters[32 * 8]);
if(reg == YMM9) return (char*) & (regd->regcontext.YmmRegisters[32 * 9]);
if(reg == YMM10) return (char*) & (regd->regcontext.YmmRegisters[32 * 10]);
if(reg == YMM11) return (char*) & (regd->regcontext.YmmRegisters[32 * 11]);
if(reg == YMM12) return (char*) & (regd->regcontext.YmmRegisters[32 * 12]);
if(reg == YMM13) return (char*) & (regd->regcontext.YmmRegisters[32 * 13]);
if(reg == YMM14) return (char*) & (regd->regcontext.YmmRegisters[32 * 14]);
if(reg == YMM15) return (char*) & (regd->regcontext.YmmRegisters[32 * 15]);
return (char*) & null_value; return (char*) & null_value;
} }

View File

@ -56,6 +56,10 @@ public:
MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15,
// YMM
YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7, YMM8,
YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15,
UNKNOWN UNKNOWN
}; };
@ -180,6 +184,7 @@ private:
QSet<REGISTER_NAME> mFPUx87; QSet<REGISTER_NAME> mFPUx87;
QSet<REGISTER_NAME> mFPUMMX; QSet<REGISTER_NAME> mFPUMMX;
QSet<REGISTER_NAME> mFPUXMM; QSet<REGISTER_NAME> mFPUXMM;
QSet<REGISTER_NAME> mFPUYMM;
// contains all id's of registers if there occurs a change // contains all id's of registers if there occurs a change
QSet<REGISTER_NAME> mRegisterUpdates; QSet<REGISTER_NAME> mRegisterUpdates;
// registers that do not allow changes // registers that do not allow changes