Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

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:

TypeParameterName
int *cpu_level_ptr
int *req_level_ptr
unsigned int **err_flags_ptr
114  memset( & flags, 0, size of flags )
115  level = 3
117  If has_eflag(X86_EFLAGS_AC) Then level = 4
120  get_cpuflags()
121  err = Returns a bitmask of which words we have error bits in
123  If Determine whether a bit is set(Long Mode (x86-64, 64-bit support) , flags) Then level = 64
126  If err == 0x01 && Not (err_flags[0] & ~( 1 << "sse" | 1 << "sse2" )) && is_amd() Then
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()
141  err = Returns a bitmask of which words we have error bits in
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))
155  Atomically set a bit in memory
156  err = Returns a bitmask of which words we have error bits in
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))
171  err = Returns a bitmask of which words we have error bits in
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
177  If cmdline_find_option_bool("forcepae") Then
178  y.c
182  Else
183  y.c
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
Caller
NameDescribe
validate_cpu