Subversion Repositories HelenOS

Rev

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

Rev 2089 Rev 2783
Line 122... Line 122...
122
}
122
}
123
 
123
 
124
void cpu_arch_init(void)
124
void cpu_arch_init(void)
125
{
125
{
126
    CPU->arch.tss = tss_p;
126
    CPU->arch.tss = tss_p;
127
    CPU->arch.tss->iomap_base = &CPU->arch.tss->iomap[0] - ((uint8_t *) CPU->arch.tss);
127
    CPU->arch.tss->iomap_base = &CPU->arch.tss->iomap[0] -
-
 
128
        ((uint8_t *) CPU->arch.tss);
128
    CPU->fpu_owner = NULL;
129
    CPU->fpu_owner = NULL;
129
}
130
}
130
 
131
 
131
void cpu_identify(void)
132
void cpu_identify(void)
132
{
133
{
Line 137... Line 138...
137
        cpuid(0, &info);
138
        cpuid(0, &info);
138
 
139
 
139
        /*
140
        /*
140
         * Check for AMD processor.
141
         * Check for AMD processor.
141
         */
142
         */
142
        if (info.cpuid_ebx==AMD_CPUID_EBX && info.cpuid_ecx==AMD_CPUID_ECX && info.cpuid_edx==AMD_CPUID_EDX) {
143
        if (info.cpuid_ebx == AMD_CPUID_EBX &&
-
 
144
            info.cpuid_ecx == AMD_CPUID_ECX &&
-
 
145
            info.cpuid_edx == AMD_CPUID_EDX) {
143
            CPU->arch.vendor = VendorAMD;
146
            CPU->arch.vendor = VendorAMD;
144
        }
147
        }
145
 
148
 
146
        /*
149
        /*
147
         * Check for Intel processor.
150
         * Check for Intel processor.
148
         */    
151
         */    
149
        if (info.cpuid_ebx==INTEL_CPUID_EBX && info.cpuid_ecx==INTEL_CPUID_ECX && info.cpuid_edx==INTEL_CPUID_EDX) {
152
        if (info.cpuid_ebx == INTEL_CPUID_EBX &&
-
 
153
            info.cpuid_ecx == INTEL_CPUID_ECX &&
-
 
154
            info.cpuid_edx == INTEL_CPUID_EDX) {
150
            CPU->arch.vendor = VendorIntel;
155
            CPU->arch.vendor = VendorIntel;
151
        }
156
        }
152
               
157
               
153
        cpuid(1, &info);
158
        cpuid(1, &info);
154
        CPU->arch.family = (info.cpuid_eax>>8)&0xf;
159
        CPU->arch.family = (info.cpuid_eax >> 8) & 0xf;
155
        CPU->arch.model = (info.cpuid_eax>>4)&0xf;
160
        CPU->arch.model = (info.cpuid_eax >> 4) & 0xf;
156
        CPU->arch.stepping = (info.cpuid_eax>>0)&0xf;                      
161
        CPU->arch.stepping = (info.cpuid_eax >> 0) & 0xf;                      
157
    }
162
    }
158
}
163
}
159
 
164
 
160
void cpu_print_report(cpu_t* m)
165
void cpu_print_report(cpu_t* m)
161
{
166
{
162
    printf("cpu%d: (%s family=%d model=%d stepping=%d) %dMHz\n",
167
    printf("cpu%d: (%s family=%d model=%d stepping=%d) %dMHz\n",
163
        m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model, m->arch.stepping,
168
        m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model,
164
        m->frequency_mhz);
169
        m->arch.stepping, m->frequency_mhz);
165
}
170
}
166
 
171
 
167
/** @}
172
/** @}
168
 */
173
 */