You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

/*
* Copyright © 2015 Matthieu DUVAL, Rudy DUCHE
*
* This file is part of RizzleHash.
*
* RizzleHash is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RizzleHash is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RizzleHash. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef CPUID_H_INCLUDED
#define CPUID_H_INCLUDED
#include <string>
#include <cpuid.h>
#include <stdint.h>
//#include <w32api.h>
class CPUID{
uint32_t regs[4];
public:
explicit CPUID(unsigned eax , unsigned ecx)
{
asm volatile ("cpuid":"=a"(regs[0]),
"=b"(regs[1]),
"=c"(regs[2]),
"=d"(regs[3]):
"a"(eax),"c"(ecx));
}
const uint32_t &EAX() const {return regs[0];}
const uint32_t &EBX() const {return regs[1];}
const uint32_t &ECX() const {return regs[2];}
const uint32_t &EDX() const {return regs[3];}
};
#endif // CPUID_H_INCLUDED