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

Re: Cobalt Qube



Sven LUTHER <luther@maxime.u-strasbg.fr> writes:
> 
> But you can always swap endianess after the booting is done, you can even have
> a different endianness during interrupts than during normal handling, or just
> change it as you need it. so there should be no problem with the firmware if
> said firmware is only used at boot time. (in my case the i am bootstrapping
> from m68k amigaos, so endianess is the less of my problems :))

Altough it is theoretically possible to change endianess dynamically,
you must realize than bisexual chips switch endianness _not_ by
swapping bytes between the memory and the processor core, but by
address renumbering. In particular, code sections are specific to one
endianess (even if the source itself do not make any assumptions about
endianness).

Much more problematic is data sharing: assuming use of 64bit bus, if
you have some structure in memory that contains just plain _bytes_,
you cannot share them easily:

char *toto;
int64 a = 0x1234
memcpy(toto,"this is a string")
[switch endianess]
printf(toto)-> will give " si siht gnirts a"
printf("%x",a)-> will give 0x1234 (the right value altough we switch endianess)

So from the software point of view, sharing data with code using
different endianness on the same machine is much more complicated than
just adding some htonl.


On the first Alphas that were doing either 32bit or 64bit access to
memory, switching endianess was mainly a matter of enabling a xor gate
on the low address line, so having a bisexual chip was quite trivial
(when you add more kind of access, like byte access and 16 bit access,
the value xored with the lower bits of addresss lines will depend on
the value size).


Regards,

Loic


Reply to: