Function report |
Source Code:arch\x86\boot\cpucheck.c |
Create Date:2022-07-28 07:26:41 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Returns -1 on error.* *cpu_level is set to the current CPU level; *req_level to the required* level. x86-64 is considered level 64 for this purpose.* *err_flags_ptr is set to the flags error array if there are flags missing.
Proto:int check_cpu(int *cpu_level_ptr, int *req_level_ptr, unsigned int **err_flags_ptr)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
int * | cpu_level_ptr | |
int * | req_level_ptr | |
unsigned int ** | err_flags_ptr |
115 | level = 3 |
117 | If has_eflag(X86_EFLAGS_AC) Then level = 4 |
120 | get_cpuflags() |
123 | If Determine whether a bit is set(Long Mode (x86-64, 64-bit support) , flags) Then level = 64 |
133 | ecx = MSR_K7_HWCR |
136 | asm("rdmsr":"=a"(eax), "=d"(edx):"c"(ecx)) |
137 | eax &= ~(1 << 15) |
138 | asm("wrmsr"::"a"(eax), "d"(edx), "c"(ecx)) |
140 | get_cpuflags() |
142 | Else if err == 0x01 && Not (err_flags[0] & ~(1 << CMPXCHG8 instruction )) && is_centaur() && model >= 6 Then |
148 | ecx = VIA Cyrix defined MSRs |
151 | asm("rdmsr":"=a"(eax), "=d"(edx):"c"(ecx)) |
152 | eax |= 1 << 1 | 1 << 7 |
153 | asm("wrmsr"::"a"(eax), "d"(edx), "c"(ecx)) |
157 | Else if err == 0x01 && is_transmeta() Then |
160 | ecx = 0x80860004 |
162 | level = 1 |
164 | asm("rdmsr":"=a"(eax), "=d"(edx):"c"(ecx)) |
165 | asm("wrmsr"::"a"(~0), "d"(edx), "c"(ecx)) |
166 | asm("cpuid":"+a"(level), "=d"(flags)::"ecx", "ebx") |
169 | asm("wrmsr"::"a"(eax), "d"(edx), "c"(ecx)) |
172 | Else if err == 0x01 && Not (err_flags[0] & ~(1 << Physical Address Extensions )) && is_intel() && Family, or 64 for x86-64 == 6 && ( model == 9 || model == 13 ) Then |
186 | If Not err Then err = check_knl_erratum() |
189 | If err_flags_ptr Then * err_flags_ptr = err ? err_flags : NULL |
191 | If cpu_level_ptr Then cpu_level_ptr = Family, or 64 for x86-64 |
193 | If req_level_ptr Then req_level_ptr = req_level |
196 | Return If Family, or 64 for x86-64 < req_level || err Then -1 Else 0 |
Name | Describe |
---|---|
validate_cpu |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |