Subversion Repositories HelenOS

Rev

Rev 2316 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2316 Rev 2317
Line 47... Line 47...
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
{
-
 
54
    struct __cpuid_extended_feature_info bits;
53
    struct __cpuid_extended_feature_info bits;
55
    uint32_t                                word;
54
    uint32_t word;
56
}cpuid_extended_feature_info;
55
} cpuid_extended_feature_info;
57
 
-
 
58
 
56
 
59
struct __cpuid_feature_info {
57
struct __cpuid_feature_info {
60
    unsigned            : 23;
58
    unsigned            : 23;
61
    unsigned mmx  :  1;
59
    unsigned mmx  :  1;
62
    unsigned fxsr :  1;
60
    unsigned fxsr :  1;
63
    unsigned sse  :  1;
61
    unsigned sse  :  1;
64
    unsigned sse2 :  1;
62
    unsigned sse2 :  1;
65
    unsigned      :  5;
63
    unsigned      :  5;
66
} __attribute__ ((packed));
64
} __attribute__ ((packed));
67
 
65
 
68
typedef union cpuid_feature_info
66
typedef union cpuid_feature_info {
69
{
-
 
70
    struct __cpuid_feature_info bits;
67
    struct __cpuid_feature_info bits;
71
    uint32_t                word       ;
68
    uint32_t word;
72
}cpuid_feature_info;
69
} cpuid_feature_info;
73
 
70
 
74
 
71
 
75
static inline uint32_t has_cpuid(void)
72
static inline uint32_t has_cpuid(void)
76
{
73
{
77
    uint32_t val, ret;
74
    uint32_t val, ret;
Line 98... Line 95...
98
}
95
}
99
 
96
 
100
static inline void cpuid(uint32_t cmd, cpu_info_t *info)
97
static inline void cpuid(uint32_t cmd, cpu_info_t *info)
101
{
98
{
102
    asm volatile (
99
    asm volatile (
103
        "movl %4, %%eax\n"
-
 
104
        "cpuid\n"
100
        "cpuid\n"
105
        : "=a" (info->cpuid_eax), "=b" (info->cpuid_ebx), "=c" (info->cpuid_ecx), "=d" (info->cpuid_edx)
101
        : "=a" (info->cpuid_eax), "=b" (info->cpuid_ebx), "=c" (info->cpuid_ecx), "=d" (info->cpuid_edx)
106
        : "m" (cmd)
102
        : "a" (cmd)
107
    );
103
    );
108
}
104
}
109
 
105
 
110
#endif
106
#endif
111
 
107