Re: [PATCH] MIPS: Display CPU byteorder in /proc/cpuinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 20 Jan 2015, Joshua Kinard wrote:

> > Userspace C code doesn't need this as it has its own standard ways of
> > determining endianness.
> > 
> > If you need to know as a user you can do:
> > 
> >    readelf -h /bin/sh | grep Data | cut -d, -f2

 I tend to use `file /sbin/init' if I need to check it for some reason -- 
less typing. ;)

> This would only tell you the endianness of the userland binary, not of the
> kernel.  While they should be one and the same (otherwise, you're not going to
> get very far anyways), they are, technically, distinctly different properties.

 Well, several MIPS processors can reverse the user-mode endianness via 
the CP0.Status.RE bit; though as you may be aware it has never been 
implemented for Linux.  Otherwise it would obviously have to be a 
per-process property (and execve(2) could flip it back).

 What you may find more interesting, we actually used to include this 
information in /proc/cpuinfo, long ago, and I believe it was removed for 
the very reason of the existence of this reverse-endianness feature.  
Which I find sort of weak an argument given that we don't support this 
stuff anyway, but given the simple ways to extract this information from 
elsewhere (/proc/config.gz is another candidate place) I have doubts if 
having it in /proc/cpuinfo adds any value too.  Not that I'd object it 
strongly either though.

 See:

commit 874124ebb6309433a2e1acf1deb95baa1c34db0b
Author: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
Date:   Sun Dec 2 11:34:32 2001 +0000

    Merge with Linux 2.4.15.

-- which actually makes me wonder what happened here as Linus's 2.4.15 
change does not include any of this stuff.  Only 2.4.19 does, 8 months 
later -- a CVS to GIT conversion problem?

  Maciej





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux