HyperDbg Debugger
Loading...
Searching...
No Matches
cpu.cpp File Reference

cpu commands More...

#include "pch.h"

Classes

class  InstructionSet

Functions

VOID CommandCpuHelp ()
 help of the cpu command
VOID CommandCpu (vector< CommandToken > CommandTokens, string Command)
 cpu command handler
VOID CpuReadVendorString (CHAR *Result)
 Reads the CPU vendor string.
int ReadCpuDetails ()
 Print out supported instruction set extensions.

Detailed Description

cpu commands

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2020-05-29

Function Documentation

◆ CommandCpu()

VOID CommandCpu ( vector< CommandToken > CommandTokens,
string Command )

cpu command handler

Parameters
CommandTokens
Command
Returns
VOID
37{
38 if (CommandTokens.size() != 1)
39 {
40 ShowMessages("incorrect use of the '%s'\n\n",
41 GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
43 return;
44 }
45
47}
std::string GetCaseSensitiveStringFromCommandToken(CommandToken TargetToken)
Get case sensitive string from command token.
Definition common.cpp:467
int ReadCpuDetails()
Print out supported instruction set extensions.
Definition cpu.cpp:264
VOID CommandCpuHelp()
help of the cpu command
Definition cpu.cpp:20

◆ CommandCpuHelp()

VOID CommandCpuHelp ( )

help of the cpu command

Returns
VOID
21{
22 ShowMessages("cpu : collects a report from cpu features.\n\n");
23
24 ShowMessages("syntax : \tcpu \n");
25}

◆ CpuReadVendorString()

VOID CpuReadVendorString ( CHAR * Result)

Reads the CPU vendor string.

Returns
VOID
253{
254 std::string VendorString = InstructionSet::Vendor();
255 strcpy(Result, VendorString.c_str());
256}
static std::string Vendor(void)
Definition cpu.cpp:60

◆ ReadCpuDetails()

int ReadCpuDetails ( )

Print out supported instruction set extensions.

Returns
int
265{
266 auto & outstream = std::cout;
267
268 auto support_message = [&outstream](std::string isa_feature,
269 bool is_supported) {
270 ShowMessages("%s %s\n", isa_feature.c_str(), (is_supported ? "supported" : "not supported"));
271 };
272
273 ShowMessages("\nvendor : %s\n", InstructionSet::Vendor().c_str());
274 ShowMessages("brand : %s\n\n", InstructionSet::Brand().c_str());
275
276 support_message("3DNOW", InstructionSet::_3DNOW());
277 support_message("3DNOWEXT", InstructionSet::_3DNOWEXT());
278 support_message("ABM", InstructionSet::ABM());
279 support_message("ADX", InstructionSet::ADX());
280 support_message("AES", InstructionSet::AES());
281 support_message("AVX", InstructionSet::AVX());
282 support_message("AVX2", InstructionSet::AVX2());
283 support_message("AVX512CD", InstructionSet::AVX512CD());
284 support_message("AVX512ER", InstructionSet::AVX512ER());
285 support_message("AVX512F", InstructionSet::AVX512F());
286 support_message("AVX512PF", InstructionSet::AVX512PF());
287 support_message("BMI1", InstructionSet::BMI1());
288 support_message("BMI2", InstructionSet::BMI2());
289 support_message("CLFSH", InstructionSet::CLFSH());
290 support_message("CMPXCHG16B", InstructionSet::CMPXCHG16B());
291 support_message("CX8", InstructionSet::CX8());
292 support_message("ERMS", InstructionSet::ERMS());
293 support_message("F16C", InstructionSet::F16C());
294 support_message("FMA", InstructionSet::FMA());
295 support_message("FSGSBASE", InstructionSet::FSGSBASE());
296 support_message("FXSR", InstructionSet::FXSR());
297 support_message("HLE", InstructionSet::HLE());
298 support_message("INVPCID", InstructionSet::INVPCID());
299 support_message("LAHF", InstructionSet::LAHF());
300 support_message("LZCNT", InstructionSet::LZCNT());
301 support_message("MMX", InstructionSet::MMX());
302 support_message("MMXEXT", InstructionSet::MMXEXT());
303 support_message("MONITOR", InstructionSet::MONITOR());
304 support_message("MOVBE", InstructionSet::MOVBE());
305 support_message("MSR", InstructionSet::MSR());
306 support_message("OSXSAVE", InstructionSet::OSXSAVE());
307 support_message("PCLMULQDQ", InstructionSet::PCLMULQDQ());
308 support_message("POPCNT", InstructionSet::POPCNT());
309 support_message("PREFETCHWT1", InstructionSet::PREFETCHWT1());
310 support_message("RDRAND", InstructionSet::RDRAND());
311 support_message("RDSEED", InstructionSet::RDSEED());
312 support_message("RDTSCP", InstructionSet::RDTSCP());
313 support_message("RTM", InstructionSet::RTM());
314 support_message("SEP", InstructionSet::SEP());
315 support_message("SHA", InstructionSet::SHA());
316 support_message("SSE", InstructionSet::SSE());
317 support_message("SSE2", InstructionSet::SSE2());
318 support_message("SSE3", InstructionSet::SSE3());
319 support_message("SSE4.1", InstructionSet::SSE41());
320 support_message("SSE4.2", InstructionSet::SSE42());
321 support_message("SSE4a", InstructionSet::SSE4a());
322 support_message("SSSE3", InstructionSet::SSSE3());
323 support_message("SYSCALL", InstructionSet::SYSCALL());
324 support_message("TBM", InstructionSet::TBM());
325 support_message("XOP", InstructionSet::XOP());
326 support_message("XSAVE", InstructionSet::XSAVE());
327
328 return 0;
329}
static bool _3DNOWEXT(void)
Definition cpu.cpp:121
static bool SSE4a(void)
Definition cpu.cpp:111
static bool XSAVE(void)
Definition cpu.cpp:74
static bool MONITOR(void)
Definition cpu.cpp:65
static bool OSXSAVE(void)
Definition cpu.cpp:75
static bool XOP(void)
Definition cpu.cpp:112
static bool SEP(void)
Definition cpu.cpp:82
static bool SSE3(void)
Definition cpu.cpp:63
static bool FMA(void)
Definition cpu.cpp:67
static bool SSE42(void)
Definition cpu.cpp:70
static bool AVX512ER(void)
Definition cpu.cpp:102
static bool MSR(void)
Definition cpu.cpp:80
static bool BMI1(void)
Definition cpu.cpp:91
static bool BMI2(void)
Definition cpu.cpp:94
static bool RDRAND(void)
Definition cpu.cpp:78
static bool _3DNOW(void)
Definition cpu.cpp:125
static bool AVX2(void)
Definition cpu.cpp:93
static bool ABM(void)
Definition cpu.cpp:110
static bool PREFETCHWT1(void)
Definition cpu.cpp:106
static bool MOVBE(void)
Definition cpu.cpp:71
static bool AVX512F(void)
Definition cpu.cpp:98
static bool SSE41(void)
Definition cpu.cpp:69
static bool ERMS(void)
Definition cpu.cpp:95
static bool F16C(void)
Definition cpu.cpp:77
static bool POPCNT(void)
Definition cpu.cpp:72
static bool MMX(void)
Definition cpu.cpp:85
static bool RTM(void)
Definition cpu.cpp:97
static bool ADX(void)
Definition cpu.cpp:100
static bool PCLMULQDQ(void)
Definition cpu.cpp:64
static std::string Brand(void)
Definition cpu.cpp:61
static bool CMPXCHG16B(void)
Definition cpu.cpp:68
static bool HLE(void)
Definition cpu.cpp:92
static bool SYSCALL(void)
Definition cpu.cpp:115
static bool AES(void)
Definition cpu.cpp:73
static bool INVPCID(void)
Definition cpu.cpp:96
static bool TBM(void)
Definition cpu.cpp:113
static bool AVX512CD(void)
Definition cpu.cpp:103
static bool SHA(void)
Definition cpu.cpp:104
static bool SSSE3(void)
Definition cpu.cpp:66
static bool LZCNT(void)
Definition cpu.cpp:109
static bool RDSEED(void)
Definition cpu.cpp:99
static bool SSE2(void)
Definition cpu.cpp:88
static bool AVX(void)
Definition cpu.cpp:76
static bool CLFSH(void)
Definition cpu.cpp:84
static bool FXSR(void)
Definition cpu.cpp:86
static bool SSE(void)
Definition cpu.cpp:87
static bool AVX512PF(void)
Definition cpu.cpp:101
static bool FSGSBASE(void)
Definition cpu.cpp:90
static bool LAHF(void)
Definition cpu.cpp:108
static bool MMXEXT(void)
Definition cpu.cpp:119
static bool RDTSCP(void)
Definition cpu.cpp:120
static bool CX8(void)
Definition cpu.cpp:81