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< string > SplitCommand, 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< string > SplitCommand,
string Command )

cpu command handler

Parameters
SplitCommand
Command
Returns
VOID
36{
37 if (SplitCommand.size() != 1)
38 {
39 ShowMessages("incorrect use of the 'cpu'\n\n");
41 return;
42 }
44}
int ReadCpuDetails()
Print out supported instruction set extensions.
Definition cpu.cpp:261
VOID CommandCpuHelp()
help of the cpu command
Definition cpu.cpp:20
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96

◆ 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
char *
250{
251 std::string VendorString = InstructionSet::Vendor();
252 strcpy(Result, VendorString.c_str());
253}
static std::string Vendor(void)
Definition cpu.cpp:57

◆ ReadCpuDetails()

int ReadCpuDetails ( )

Print out supported instruction set extensions.

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