Re: Endianness of freeBSD

2008-02-04 Thread Heiko Wundram (Beenic)
Am Montag, 4. Februar 2008 13:03:25 schrieb navneet Upadhyay:
 1. Is FreeBSD little Endian like windows?

FreeBSD endianness depends on the hardware architecture it runs on (as 
endianness is a hardware characterization). (Very) generally, anything that's 
related to an Intel CPU is little-endian, whereas anything that's related to 
a Motorola, IBM or Sparc CPU is big-endian.

(Modern) Windows exists only on little-endian hardware [Intel, AMD and clones] 
(AFAIK, someone correct me here), so basically it's always little-endian, you 
could say that. There were Windows versions for other CPUs, though, back in 
the Windows NT days, which ran on Alpha workstations which were big-endian.

 2. Linux is Big endian?

Same as for FreeBSD.

 wrote a code int i = 1;if((i  1) == 0) little else big
 got little on all platforms bsd,linux,windows.

This won't tell you what endianness the platform has. It'll say little for 
any architecture (because ( 1  1 ) == 0 for any CPU that knows how to do 
binary shifts).

What you can use to test for little or big-endianness, is something like the 
following:

unsigned long test = 0x12345678;
char* ptest = (char*)test;

if( *ptest == 0x78 )
is little
else if( *ptest == 0x12 )
is big
else
something else ?

 *Does endianness depends on OS or the hardware?*

As I said above: it depends on the hardware. There is even hardware (ARM, in 
particular) which can run in little- or big-endian mode, depending on how it 
is initialized.

-- 
Heiko Wundram
Product  Application Development
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Endianness of freeBSD

2008-02-04 Thread Ivan Voras
 1. Is FreeBSD little Endian like windows?
=20
 2. Linux is Big endian?
=20
 wrote a code int i =3D 1;if((i  1) =3D=3D 0) little else big
 got little on all platforms bsd,linux,windows.
=20
 *Does endianness depends on OS or the hardware?*

It depends on the hardware.
http://en.wikipedia.org/wiki/Endianess




signature.asc
Description: OpenPGP digital signature


Re: Endianness of freeBSD

2008-02-04 Thread Wojciech Puchar


Not true. Alpha is big- or little-endian (so, it's bi-endian), depending on
how it's booted, and IIRC the Windows NT version running on Alpha used the
big-endian mode of the CPU. But I might be mistaken.


i had SRM console used netbsd too later, too little endian.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Endianness of freeBSD

2008-02-04 Thread Wojciech Puchar

the Windows NT days, which ran on Alpha workstations which were big-endian.


Alpha is little endian. i had alpha 21066 running linux.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Endianness of freeBSD

2008-02-04 Thread navneet Upadhyay
1. Is FreeBSD little Endian like windows?

2. Linux is Big endian?

wrote a code int i = 1;if((i  1) == 0) little else big
got little on all platforms bsd,linux,windows.

*Does endianness depends on OS or the hardware?*
**
**
*Thanks,*
*navneet*
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Endianness of freeBSD

2008-02-04 Thread Wouter Oosterveld
Endianness depends on the hardware.

In internal kernel structures endianness does not matter, if
communicating with other machines protocols (usually) define a
bitorder.

The c-library and/or systemlibrary contains utility functions for conversion.

Regards,

Wouter Oosterveld

2008/2/4, navneet Upadhyay [EMAIL PROTECTED]:
 1. Is FreeBSD little Endian like windows?

 2. Linux is Big endian?

 wrote a code int i = 1;if((i  1) == 0) little else big
 got little on all platforms bsd,linux,windows.

 *Does endianness depends on OS or the hardware?*
 **
 **
 *Thanks,*
 *navneet*
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]



-- 
[
  [EMAIL PROTECTED] is binnenkort niet meer,
[EMAIL PROTECTED] is mijn nieuwe email-adres.
]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Endianness of freeBSD

2008-02-04 Thread Wojciech Puchar



1. Is FreeBSD little Endian like windows?

2. Linux is Big endian?

wrote a code int i = 1;if((i  1) == 0) little else big
got little on all platforms bsd,linux,windows.

*Does endianness depends on OS or the hardware?*


on hardware
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Endianness of freeBSD

2008-02-04 Thread Christian Weisgerber
Heiko Wundram (Beenic) [EMAIL PROTECTED] wrote:

  Alpha is little endian. i had alpha 21066 running linux.
 
 Not true. Alpha is big- or little-endian (so, it's bi-endian),

Alpha is little-endian in practice.  I've never heard of DEC--or
anybody else for that matter--building a big-endian alpha.  Note
that DEC's previous CPU architecture, the VAX, was also little-endian.

 depending on how it's booted,

... on how _the CPU_ is booted, yes.  By the time you are running
firmware and thinking of booting an operating system, it's much too
late.

 and IIRC the Windows NT version running on Alpha used the 
 big-endian mode of the CPU. But I might be mistaken.

I think you are mistaken.  The ARC MIPS platform, which Windows NT
originally was written for, was also little-endian.

-- 
Christian naddy Weisgerber  [EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Endianness of freeBSD

2008-02-04 Thread Heiko Wundram (Beenic)
Am Montag, 4. Februar 2008 14:30:12 schrieb Wojciech Puchar:
  the Windows NT days, which ran on Alpha workstations which were
  big-endian.

 Alpha is little endian. i had alpha 21066 running linux.

Not true. Alpha is big- or little-endian (so, it's bi-endian), depending on 
how it's booted, and IIRC the Windows NT version running on Alpha used the 
big-endian mode of the CPU. But I might be mistaken.

-- 
Heiko Wundram
Product  Application Development
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Endianness of freeBSD

2008-02-04 Thread Enno Davids
On Mon, Feb 04, 2008 at 01:20:14PM +0100, Heiko Wundram (Beenic) wrote:
|
|As I said above: it depends on the hardware. There is even hardware (ARM, in 
|particular) which can run in little- or big-endian mode, depending on how it 
|is initialized.

If I recall correctly some of the MIPS chips had/ve an endian selector bit
on each page table entry in the MMU. The idea was to map each of the I/O
devices through the MMU and let that bit help in talking to the hardware
(i.e. Intel peripherals expecting little endian and motorola chips wanting
the opposite.)


E.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]