maths-help-seeker
maths-help-seeker

Reputation: 966

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?

Upvotes: 0

Views: 129

Answers (2)

Rahul R Dhobi
Rahul R Dhobi

Reputation: 5806

You can read /proc/cpuinfo to get cpu type

Upvotes: 2

Antoine
Antoine

Reputation: 14074

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.

Upvotes: 1

Related Questions