Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setarch on qemu i486 raises to i686 #707

Closed
deep-42-thought opened this issue Oct 18, 2018 · 1 comment
Closed

setarch on qemu i486 raises to i686 #707

deep-42-thought opened this issue Oct 18, 2018 · 1 comment

Comments

@deep-42-thought
Copy link

On archlinux: running setarch i486 uname -m on a qemu i486 vm (and also on a AMD-K6 bare metal i586) reports i686 (vm was started by qemu-system-i386 -cpu 486 -enable-kvm ...)

uname -m -> i486
cat /proc/cpuinfo ->

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 4
model		: 8
model name	: 486 DX/4
stepping	: 0
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 1
wp		: yes
flags		: fpu vme pse cpuid tsc_known_freq x2apic hypervisor cpuid_fault
bugs		:
bogomips	: 6419.12
clflush size	: 32
cache_alignment	: 32
address sizes	: 32 bits physical, 32 bits virtual
power management:

I understand, that (and why) running setarch i486 uname -m on x86_64 reports i686, but shouldn't setarch not raise the reported architecture?

regards,
Erich

@karelzak
Copy link
Collaborator

The i486 is only alias to PER_LINUX32 personality. There is not special 486 personality and kernel interprets it as generic i686.

This is common thing -- we have PER_LINUX32 and PER_LINUX only (see "man personality"), and all the aliases in setarch command are mapped to these two personalities for all architectures. The difference is only in the name of the architecture (ppc64, ia64, sparc64, ..) but internally it's all PER_LINUX (64bit) or PER_LINUX (32bit).

#if defined(__x86_64__) || defined(__i386__) || defined(__ia64__)
                {PER_LINUX32,   "i386",         "i386"},
                {PER_LINUX32,   "i486",         "i386"},
                {PER_LINUX32,   "i586",         "i386"},
                {PER_LINUX32,   "i686",         "i386"},
                {PER_LINUX32,   "athlon",      "i386"},
#endif                  
#if defined(__x86_64__) || defined(__i386__)
                {PER_LINUX,     "x86_64",       "x86_64"},
#endif

columns: 1st is personality, 2nd is alias, 3rd is target name (may be on the fly updated to "i686").

It means all "setarch i{3,4,5,6}86" will get the same result i686 (or i386).

Frankly, I don't think these aliases are super friendly to users (at least on first glance) as people sometimes assume something more than 32/64bit switch, but it's too late to change it :-)

I do not see anything to fix in setarch command, maybe improve docs. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants