question about the little-endian in sparc

hi folks, in the sparc v9 manul , it says it is possible to access the memory data in little-endian mode, but there is only privilaged instruction that could set the PSTATE ( the cle bit ) regist. if I'm in the user mode , is it possible for me to access the data in little-endian mode?

No, the OS determines the endian type for the system. This feature is so that you could more easily port a little endian OS to a sparc cpu. Ideally, you should ignore endianness. Solaris is both little endian on intel and big endian on sparc. A well written program will work in either version.

You can't from user mode because, as you already noticed, this instruction is privileged. You can't even do it unless you implement your own system call as there is no support for doing it under Solaris.

That little endian mode was designed to allow porting Windows NT to the SPARC architecture, a port which obviously was never released.
http://ftp.lanet.lv/ftp/sun-info/sunflash/1993/Jul/55.11-Sun-Intergraph:-SPARC-and-Windows-NT

Great link! I had a suspicion that this feature was implemented with NT in mind, but I didn't think that I would ever see any proof of that.

is there some solaris os using little-endian mode ? if the open-solaris support intel x86 cpu , then there must exist some solaris os supporting little-endian mode, but I'm not sure if I can install it on sparc system.

The Solaris source code is portable to SPARC and x86/x64. It is always built on big endian when on SPARC and little endian when on x86/x64.

Compiling the SPARC kernel in little endian would probably be quite a complex (and useless?) task. I'm not sure how hardware support would be impacted.

What exactly are you trying to achieve ?

MAybe the OP needs htonl() --
htonl

The function itself will not help Solaris is big endian and so is the "network", but there are lots of examples of code out there that switches endian-ness (endianity?)

I'd like to handle the little-endian binary code from other system( like linux) on a sparc system at instruction level, so if I can't load the data in little-endian mode, then i have to add some instructions to swith it , it's nearly more then 10 instructions, and if to every load(or store) instruction on sparc , I have to swith it from little-endian to big-endian( or from big-endian to little-endian) , it's really too inefficient.

What little-endian binary code is this ? Is it really code or data ? SPARC code must be big-endian regardless or the data mode.
How much volume / bandwitch do you handle ?

I dig a little in the Solaris kernel code and found out that there is actually some provision for little-endian operations on UltraSPARC after all.

See that source code for an example.
Cross Reference: /onnv/onnv-gate/usr/src/common/openssl/crypto/md5/asm/md5-sparcv9.S

Thank you very much.

We are trying to build a dynamic binary translation tool that could run the x86 code on a sparc system. And little-endian binary code means a common executable binary code in linux , such as the elf file, but I treat it as input data, and I manually generate some sparc instructions to handle it.

Interesting but not an easy task. Wabi used to do that on Solaris.