Messages in this thread | | | Date | Fri, 30 Jul 1999 08:39:57 +0200 (MET DST) | From | Gerard Roudier <> | Subject | Re: endiannes of the kernel |
| |
On 29 Jul 1999, H. Peter Anvin wrote:
> Followup to: <Pine.LNX.3.95.990729213635.852A-100000@localhost> > By author: Gerard Roudier <groudier@club-internet.fr> > In newsgroup: linux.dev.kernel > > > > If both endian modes are really equivalent for the hardware, then the > > right choice may depend on the following: > > > > - If you are a purist, you may just toss a coin to decide, since none > > endian mode is superior to the other one. > > > > This is the common "peacemaking" wisdom, but I think, in fact, there > are valid technical arguments for both views (my own techical > assessment: littleendian is technically superior, but bigendian is > used on the 'net. Some humans find littleendian confusing because > most modern human writing systems write numbers in bigendian form.)
You may elect to use a quite unfair coin if you want, the decision will be also quite good. ;-)
The endian mode defines how the CPU adresses partial accesses to a machine WORD. For well designed and well written applications that may share data representations using a given mode, the endian mode is a no-issue.
What is inferior is for a CPU to have to deal with data using the opposite endian mode or having been designed to be optimal for the opposite mode.
And even if one endian mode had some advantage in theory, it would be so minor, that the 50-50 pro-con ratio would exist forever in my opinion.
> You sometimes find that drivers written on littleendian systems don't > work on bigendian systems without porting, since there are some > shortcuts that littleendian representation allows which are invalid on > bigendian.
The domination of PCI and Intel platforms should be considered for the choice here.
Explicit shortcuts along the code are ugly and some minimal abstraction should be used for them. "#define" and "inline" are your friends for them to possibly be redefined, without any impact for the mode that may take advantage of the data representation, and make code cleaner and more understandable.
> > - If you are rather pragmatic, you want to choose the endian mode of > > the architecture that has the best Linux support, thus little endian. > > (You must also think about all other tools needed for the O/S, and that > > may have to deal with endianness).
Gérard.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |