Subversion Repositories HelenOS-historic

Rev

Rev 1731 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1731 Rev 1780
Line 36... Line 36...
36
#define __ia32_CPUID_H__
36
#define __ia32_CPUID_H__
37
 
37
 
38
#include <arch/types.h>
38
#include <arch/types.h>
39
 
39
 
40
struct cpu_info {
40
struct cpu_info {
41
    __u32 cpuid_eax;
41
    uint32_t cpuid_eax;
42
    __u32 cpuid_ebx;
42
    uint32_t cpuid_ebx;
43
    __u32 cpuid_ecx;
43
    uint32_t cpuid_ecx;
44
    __u32 cpuid_edx;
44
    uint32_t cpuid_edx;
45
} __attribute__ ((packed));
45
} __attribute__ ((packed));
46
 
46
 
47
struct __cpuid_extended_feature_info {
47
struct __cpuid_extended_feature_info {
48
    unsigned sse3 :  1;
48
    unsigned sse3 :  1;
49
    unsigned      : 31;
49
    unsigned      : 31;
50
} __attribute__ ((packed));
50
} __attribute__ ((packed));
51
 
51
 
52
typedef union cpuid_extended_feature_info
52
typedef union cpuid_extended_feature_info
53
{
53
{
54
    struct __cpuid_extended_feature_info bits;
54
    struct __cpuid_extended_feature_info bits;
55
    __u32                                word;
55
    uint32_t                                word;
56
}cpuid_extended_feature_info;
56
}cpuid_extended_feature_info;
57
 
57
 
58
 
58
 
59
struct __cpuid_feature_info {
59
struct __cpuid_feature_info {
60
    unsigned            : 23;
60
    unsigned            : 23;
Line 66... Line 66...
66
} __attribute__ ((packed));
66
} __attribute__ ((packed));
67
 
67
 
68
typedef union cpuid_feature_info
68
typedef union cpuid_feature_info
69
{
69
{
70
    struct __cpuid_feature_info bits;
70
    struct __cpuid_feature_info bits;
71
    __u32                word       ;
71
    uint32_t                word       ;
72
}cpuid_feature_info;
72
}cpuid_feature_info;
73
 
73
 
74
 
74
 
75
static inline __u32 has_cpuid(void)
75
static inline uint32_t has_cpuid(void)
76
{
76
{
77
    __u32 val, ret;
77
    uint32_t val, ret;
78
   
78
   
79
    __asm__ volatile (
79
    __asm__ volatile (
80
        "pushf\n"               /* read flags */
80
        "pushf\n"               /* read flags */
81
        "popl %0\n"
81
        "popl %0\n"
82
        "movl %0, %1\n"
82
        "movl %0, %1\n"
Line 95... Line 95...
95
    );
95
    );
96
   
96
   
97
    return ret;
97
    return ret;
98
}
98
}
99
 
99
 
100
static inline void cpuid(__u32 cmd, struct cpu_info *info)
100
static inline void cpuid(uint32_t cmd, struct cpu_info *info)
101
{
101
{
102
    __asm__ volatile (
102
    __asm__ volatile (
103
        "movl %4, %%eax\n"
103
        "movl %4, %%eax\n"
104
        "cpuid\n"
104
        "cpuid\n"
105
       
105