简体   繁体   中英

How can the cpu type be read in the linux kernel code (viz. x86, x86_64)?

I want to detect the cpu type while the kernel is booting (viz. x86 or x86_64) so that I can do a task differently based on the cpu type. Is there a simple way to know the CPU type?

您可以阅读/proc/cpuinfo以获取cpu类型

How about the cpuid instruction ?

There is a module interfacing it, source code is here .

If interested, also have a look here or here or here for other examples.

Also have a look at this question for using cpuid to know if your system supports SSE.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM