Added missing registers and CPUID feature-flags

This commit is contained in:
flobernd 2016-11-27 23:24:43 +01:00
parent 8dafd68211
commit 9a0b1da975
8 changed files with 24 additions and 110 deletions

View File

@ -25,8 +25,6 @@ object frmEditorX86Registers: TfrmEditorX86Registers
Margins.Top = 0
Align = alBottom
TabOrder = 1
ExplicitTop = 379
ExplicitWidth = 588
DesignSize = (
688
39)
@ -43,7 +41,6 @@ object frmEditorX86Registers: TfrmEditorX86Registers
Images = imgIcons16
TabOrder = 1
OnClick = btnCancelClick
ExplicitLeft = 468
end
object btnApply: TButton
Left = 450
@ -58,7 +55,6 @@ object frmEditorX86Registers: TfrmEditorX86Registers
Images = imgIcons16
TabOrder = 0
OnClick = btnApplyClick
ExplicitLeft = 350
end
end
object VirtualTreeView: TVirtualStringTree
@ -85,8 +81,6 @@ object frmEditorX86Registers: TfrmEditorX86Registers
OnFreeNode = VirtualTreeViewFreeNode
OnGetText = VirtualTreeViewGetText
OnGetImageIndex = VirtualTreeViewGetImageIndex
ExplicitWidth = 588
ExplicitHeight = 373
Columns = <>
end
object imgIcons16: TcxImageList

View File

@ -142,7 +142,7 @@ begin
VirtualTreeView.Expanded[N1] := true;
N1 := AddCategory(Root, 'Special Registers');
AddRegisterRange(N1, regRFLAGS, regMXCSR);
AddRegisterRange(N1, regRFLAGS, regXCR0);
N1 := AddCategory(Root, 'Segment Registers');
AddRegisterRange(N1, regES, regFS);

View File

@ -172,7 +172,10 @@ type
cfXSAVEOPT,
cfMFENCE,
cfVBMI,
cfIFMA
cfIFMA,
cfVMX,
cfSMX,
cfOSPKE
);
TCPUIDFeatureFlagSet = set of TCPUIDFeatureFlag;
@ -233,7 +236,8 @@ type
regXMM16, regXMM17, regXMM18, regXMM19, regXMM20, regXMM21, regXMM22, regXMM23,
regXMM24, regXMM25, regXMM26, regXMM27, regXMM28, regXMM29, regXMM30, regXMM31,
// Special registers
regRFLAGS, regEFLAGS, regFLAGS, regRIP, regEIP, regIP, regMXCSR,
regRFLAGS, regEFLAGS, regFLAGS, regRIP, regEIP, regIP, regMXCSR, regPKRU,
regXCR0,
// Segment registers
regES, regCS, regSS, regDS, regGS, regFS,
// Table registers
@ -1040,7 +1044,10 @@ const
'xsaveopt',
'mfence',
'vbmi',
'ifma'
'ifma',
'vmx',
'smx',
'ospke'
);
{$ENDREGION}
@ -1081,7 +1088,8 @@ const
'xmm16', 'xmm17', 'xmm18', 'xmm19', 'xmm20', 'xmm21', 'xmm22', 'xmm23',
'xmm24', 'xmm25', 'xmm26', 'xmm27', 'xmm28', 'xmm29', 'xmm30', 'xmm31',
// Special registers
'rflags', 'eflags', 'flags', 'rip', 'eip', 'ip', 'mxcsr',
'rflags', 'eflags', 'flags', 'rip', 'eip', 'ip', 'mxcsr', 'pkru',
'xcr0',
// Segment registers
'es', 'cs', 'ss', 'ds', 'gs', 'fs',
// Table registers
@ -1760,7 +1768,7 @@ var
RegsWrite: TX86RegisterSet;
R: TX86Register;
begin
Exit(false); // TODO: Remove
//Exit(false); // TODO: Remove
Result := false;
F[ 0] := @FCF; F[ 1] := @FPF; F[ 2] := @FAF; F[ 3] := @FZF; F[ 4] := @FSF;
F[ 5] := @FTF; F[ 6] := @FIF; F[ 7] := @FDF; F[ 8] := @FOF; F[ 9] := @FRF;

View File

@ -165,29 +165,6 @@ ZYDIS_EXPORT ZydisStatus ZydisDecoderInitInstructionDecoder(ZydisInstructionDeco
ZYDIS_EXPORT ZydisStatus ZydisDecoderInitInstructionDecoderEx(ZydisInstructionDecoder* decoder,
ZydisDisassemblerMode disassemblerMode, ZydisCustomInput* input, ZydisDecoderFlags flags);
/**
* @brief Returns the current disassembler-mode of the given @c ZydisInstructionDecoder
* instance.
*
* @param decoder A pointer to the @c ZydisInstructionDecoder instance.
* @param disassemblerMode A pointer to the memory that receives the current disassembler-mode.
*
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisDecoderGetDisassemblerMode(const ZydisInstructionDecoder* decoder,
ZydisDisassemblerMode* disassemblerMode);
/**
* @brief Changes the disassembler-mode of the given @c ZydisInstructionDecoder instance.
*
* @param decoder A pointer to the @c ZydisInstructionDecoder instance.
* @param disassemblerMode The new disassembler-mode.
*
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisDecoderSetDisassemblerMode(ZydisInstructionDecoder* decoder,
ZydisDisassemblerMode disassemblerMode);
/**
* @brief Returns the current input data-source of the given @c ZydisInstructionDecoder
* instance.
@ -197,7 +174,7 @@ ZYDIS_EXPORT ZydisStatus ZydisDecoderSetDisassemblerMode(ZydisInstructionDecoder
*
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisDecoderGetDecoderInput(const ZydisInstructionDecoder* decoder,
ZYDIS_EXPORT ZydisStatus ZydisDecoderGetInput(const ZydisInstructionDecoder* decoder,
ZydisCustomInput** input);
/**
@ -210,31 +187,9 @@ ZYDIS_EXPORT ZydisStatus ZydisDecoderGetDecoderInput(const ZydisInstructionDecod
*
* This function flushes the internal input-buffer.
*/
ZYDIS_EXPORT ZydisStatus ZydisDecoderSetDecoderInput(ZydisInstructionDecoder* decoder,
ZYDIS_EXPORT ZydisStatus ZydisDecoderSetInput(ZydisInstructionDecoder* decoder,
ZydisCustomInput* input);
/**
* @brief Returns the current decoder-flags of the given @c ZydisInstructionDecoder instance.
*
* @param decoder A pointer to the @c ZydisInstructionDecoder instance.
* @param flags A pointer to the memory that receives the current decoder-flags.
*
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisDecoderGetDecoderFlags(const ZydisInstructionDecoder* decoder,
ZydisDecoderFlags* flags);
/**
* @brief Changes the decoder-flags of the given @c ZydisInstructionDecoder instance.
*
* @param decoder A pointer to the @c ZydisInstructionDecoder instance.
* @param flags The new decoder-flags.
*
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisDecoderSetDecoderFlags(ZydisInstructionDecoder* decoder,
ZydisDecoderFlags flags);
/**
* @brief Returns the current instruction-pointer of the given @c ZydisInstructionDecoder
* instance.

View File

@ -106,7 +106,8 @@ enum ZydisRegisters
ZYDIS_REGISTER_XMM28, ZYDIS_REGISTER_XMM29, ZYDIS_REGISTER_XMM30, ZYDIS_REGISTER_XMM31,
// Special registers
ZYDIS_REGISTER_RFLAGS, ZYDIS_REGISTER_EFLAGS, ZYDIS_REGISTER_FLAGS, ZYDIS_REGISTER_RIP,
ZYDIS_REGISTER_EIP, ZYDIS_REGISTER_IP, ZYDIS_REGISTER_MXCSR,
ZYDIS_REGISTER_EIP, ZYDIS_REGISTER_IP, ZYDIS_REGISTER_MXCSR, ZYDIS_REGISTER_PKRU,
ZYDIS_REGISTER_XCR0,
// Segment registers
ZYDIS_REGISTER_ES, ZYDIS_REGISTER_SS, ZYDIS_REGISTER_CS, ZYDIS_REGISTER_DS,
ZYDIS_REGISTER_FS, ZYDIS_REGISTER_GS,

View File

@ -36,6 +36,8 @@
#include <Zydis/Decoder.h>
#include <Zydis/Formatter.h>
// TODO: Replace "bool" with a custom - compiler-unspecific sized - zype
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -2350,32 +2350,7 @@ ZydisStatus ZydisDecoderInitInstructionDecoderEx(ZydisInstructionDecoder* decode
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisDecoderGetDisassemblerMode(const ZydisInstructionDecoder* decoder,
ZydisDisassemblerMode* disassemblerMode)
{
if (!decoder || !disassemblerMode)
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
*disassemblerMode = decoder->disassemblerMode;
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisDecoderSetDisassemblerMode(ZydisInstructionDecoder* decoder,
ZydisDisassemblerMode disassemblerMode)
{
if (!decoder ||
((disassemblerMode != ZYDIS_DISASSEMBLER_MODE_16BIT) &&
(disassemblerMode != ZYDIS_DISASSEMBLER_MODE_32BIT) &&
(disassemblerMode != ZYDIS_DISASSEMBLER_MODE_64BIT)))
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
decoder->disassemblerMode = disassemblerMode;
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisDecoderGetDecoderInput(const ZydisInstructionDecoder* decoder,
ZydisStatus ZydisDecoderGetInput(const ZydisInstructionDecoder* decoder,
ZydisCustomInput** input)
{
if (!decoder || !input)
@ -2386,7 +2361,7 @@ ZydisStatus ZydisDecoderGetDecoderInput(const ZydisInstructionDecoder* decoder,
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisDecoderSetDecoderInput(ZydisInstructionDecoder* decoder,
ZydisStatus ZydisDecoderSetInput(ZydisInstructionDecoder* decoder,
ZydisCustomInput* input)
{
if (!decoder)
@ -2400,28 +2375,6 @@ ZydisStatus ZydisDecoderSetDecoderInput(ZydisInstructionDecoder* decoder,
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisDecoderGetDecoderFlags(const ZydisInstructionDecoder* decoder,
ZydisDecoderFlags* flags)
{
if (!decoder || !flags)
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
*flags = decoder->flags;
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisDecoderSetDecoderFlags(ZydisInstructionDecoder* decoder,
ZydisDecoderFlags flags)
{
if (!decoder)
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
decoder->flags = flags;
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisDecoderGetInstructionPointer(const ZydisInstructionDecoder* decoder,
uint64_t* instructionPointer)
{

View File

@ -91,7 +91,8 @@ const char* registerStrings[] =
"xmm28", "xmm29", "xmm30", "xmm31",
// Special registers
"rflags", "eflags", "flags", "rip",
"eip", "ip", "mxcsr",
"eip", "ip", "mxcsr", "pkru",
"xcr0",
// Segment registers
"es", "ss", "cs", "ds",
"fs", "gs",