summaryrefslogtreecommitdiffstats
path: root/kernel/details/Platform.h
blob: 12a835307b24888aca18a61726f7c9653cf56663 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef PLATHFORMDETAILS_H
#define PLATHFORMDETAILS_H


namespace cpuid
{

/**
 * Platform independent class to acquire processor details
 */
class Executor
{
    bool isCpuidAvailable;
public:
    /**
     * Standard constructor of Executor class
     *
     * @note Must be declare in platform depended part of code by path
     *     `arch/{architecture}/cpuid/`.
     */
    Executor();

    /**
     * Perform cpuid command
     *
     * @tparam T the type posed processor details by one kind
     * @param[out] instance to fill the details
     */
    template<typename T>
    void cpuid(T &cmd)
    {
       if(isCpuidAvailable)
        {
            acquireInformation(cmd);
        }
    }

    /**
     * Availability of cpuid command
     *
     * @return true if cpuid command would execute,
     *     false otherwise
     */
    bool isCpuidWouldExecute() {return isCpuidAvailable;};
};

};

#endif