0

When execute:

$ cat /sys/devices/system/cpu/modalias;
cpu:type:x86,ven0002fam0019mod0021:feature:,0000,

Says have a 32 bit cpu, but have a ryzen 7 5800X3D, is a 64 bit cpu, what happens?

$ cat /proc/cpuinfo | grep Ryzen | head -n 1
model name  : AMD Ryzen 7 5800X3D 8-Core Processor
$ uname -i
x86_64

modalias file is not the cpu architecture representation?

e-info128
  • 175
  • 3
    x86 is not 32-bit in that context, It's just less specific then x86_64. One have x86-16 as well etc (https://en.wikipedia.org/wiki/X86). The modalias also includes vendor, family and model + feature-list. – ibuprofen Aug 28 '22 at 05:03
  • 1
    Where does it say 32 bit? It says x86 which is ether 32bit or 64bit. It also says x86_64, that is the 64bit variant. MS use the word x64 for 64 bit, which they contrast with x86 (which I assume they think is a 86 bit processor). – ctrl-alt-delor Aug 28 '22 at 07:44

3 Answers3

4

It seems you are misinterpreting the info look here

What you're looking for is flag: lm. It stands for X86_FEATURE_LM, the Long Mode (64bit) support. If you can find the "lm" flag among your CPU flags, this means you're looking at a 64bit capable processor.

The keyword here is capable.

vfbsilva
  • 3,697
4

The cpu/modalias show you:

cpu:type:x86,ven0002fam0019mod0021:feature:[FEATURE LIST]

x86 in this context does not mean 32-bit, but that it is part of the x86 instruction set architecture family where one have both Intel and AMD. The x86 architecture has 16, 32 and 64 bits.

It further say (which is "translated" in /proc/cpuinfo):

The kernel uses the CPUID instruction (specific for x86) to get a list of features from the CPU. (The article show how this can be done using assembly).

You are interested in long-mode (LM) which is identified by 61 (0x003D) in the feature list.

Did a crude script to list the features by parsing the cpufeatures.h file from the kernel source:

#! /bin/bash -

Hash-like map with features from cpufeatures.h

An ugly and likely unreliable sed parse :P

https://github.com/torvalds/linux/blob/10d4879f9ef01cc6190fafe4257d06f375bab92c/arch/x86/include/asm/cpufeatures.h

declare -A features=() while IFS=$'\t' read -r a b c; do a=$((a)) x=$(printf "%04X" $a) features[$x]="$(printf "%s %3d\t%-24s\t%s" "$x" "$a" "$b" "$c")" done< <(sed -n ' s;^#define X86_FEATURE_([^ ]+)\s+(([^)]+)) /*(.*) */$;\2\t\1\t\3;p'
cpufeatures.h)

Give any argument to script to print all

possible features defined in cpufeatures.h:

if [ $# = 1 ]; then printf 'cpufeatures:\n' printf '%s\n' "${features[@]}" | sort printf '\n' fi

Print all features from system's CPU.

Unknown are denoted by * (N/A)

printf '/sys/devices/system/cpu/modalias features:\n' while IFS= read -r feature; do ent=${features[$feature]} if [ -z "$ent" ]; then printf '%s %3d\t(N/A)\n' "$feature" "$((0x$feature))" else printf '%s\n' "$ent" fi done< <(sed 's/^.feature:,?(.*),?$/\1/;s/,/\n/g'
/sys/devices/system/cpu/modalias | sort)

Gives you a full list like:

/sys/devices/system/cpu/modalias features:
0000   0    FPU                          Onboard FPU
0001   1    VME                          Virtual Mode Extensions
0002   2    DE                           Debugging Extensions
0003   3    PSE                          Page Size Extensions
0004   4    TSC                          Time Stamp Counter
0005   5    MSR                          Model-Specific Registers
0006   6    PAE                          Physical Address Extensions
0007   7    MCE                          Machine Check Exception
0008   8    CX8                          CMPXCHG8 instruction
0009   9    APIC                         Onboard APIC
000B  11    SEP                          SYSENTER/SYSEXIT
000C  12    MTRR                         Memory Type Range Registers
000D  13    PGE                          Page Global Enable
000E  14    MCA                          Machine Check Architecture
... and so on

Checking for long-mode this should for example give you:

 ./cpufeatures | grep Long
003D  61    LM                           Long Mode (x86-64, 64-bit support)

The list should be partially the same as flags in /proc/cpuinfo.

ibuprofen
  • 2,890
0

x86_64 (wikipedia) identified as 64-bit already in your question.