Hi,

On Jan 23, 2008 10:18 AM, Li Xiaodong <[EMAIL PROTECTED]> wrote:
>
> Thank you.
> Actually, I do not know what is little-endian and what is big-endian before
> this time.
> Despite that mistake, are the arrangements of memory I wrote correct (on
> little-endian processor)?

Here is a clear explanation:
http://en.wikipedia.org/wiki/Endianness#Examples_of_storing_the_value_0x0A0B0C0D_in_memory

Q1 was correct:
0 34
1 ef
2 cd
on little endian and
0 cd
1 ef
2 34
on big endian.

Q2: since the offsets were defined as
offset 0   i/o address
offset 3   i/o value

The i/o address is 0xef4523 on little endian, and 0x2345ef on big endian.
The i/o value is 0x0102df on little endian, and 0xdf0201 on little endian

It's true that the offsets look strange, since normally one would have
4 bytes for such values (32-bit addresses).


Q3: correct. The value you write in C is always with MSB first, and
LSB last. During compilation, this is translated to the correct byte
order for the machine you are targeting.


Best regards,
Thomas

>
>
> > -----Original Message-----
> > From: Thomas De Schampheleire [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, January 23, 2008 5:10 PM
> > To: Li Xiaodong
> > Cc: [EMAIL PROTECTED]; kernelnewbies@nl.linux.org
> > Subject: Re: Question about Endian Order
> >
> > Hello,
> >
> > On Jan 23, 2008 9:37 AM, Li Xiaodong <[EMAIL PROTECTED]> wrote:
> > > Hi Vichy,
> > >
> > > To q1,
> > >
> > > I think the memory contents should be (on Linux):
> >
> > I think you are mistaken here. The endianness is not a property of the
> > operating system, but rather a property of the processor you are
> > running on. Linux runs both on little endian (like x86) as on big
> > endian processors. Some processors can even run as little endian and
> > as big endian, where you can choose which one you want by executing a
> > certain instruction or writing to a certain register.
> >
> > Thomas
>
>
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to