* Questions?
@ 2002-03-06 17:25 Marc Karasek
2002-03-06 18:20 ` Questions? Steven J. Hill
` (5 more replies)
0 siblings, 6 replies; 19+ messages in thread
From: Marc Karasek @ 2002-03-06 17:25 UTC (permalink / raw)
To: Linux MIPS
I have some general questions for all:
How many of you are involved with embedded linux development using a
MIPS processor?
What endianess have you chosen for your project and why?
If you have not guessed it, I am involved with a MIPS/Linux embedded
project and we are trying to determine if there are any pros or cons in
one endianess over the other.
--
/*************************
Marc Karasek
Sr. Firmware Engineer
iVivity Inc.
marc_karasek@ivivity.com
678.990.1550 x238
678.990.1551 Fax
*************************/
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Questions?
2002-03-06 17:25 Questions? Marc Karasek
@ 2002-03-06 18:20 ` Steven J. Hill
2002-03-06 18:43 ` Questions? Marc Karasek
2002-03-06 19:06 ` Questions? Mike McDonald
` (4 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Steven J. Hill @ 2002-03-06 18:20 UTC (permalink / raw)
To: Marc Karasek; +Cc: Linux MIPS
Marc Karasek wrote:
>
> How many of you are involved with embedded linux development using a
> MIPS processor?
>
A fair number of us. Over a hundred easily.
> What endianess have you chosen for your project and why?
>
You don't really want to start this holy war, do you? That aside,
usually big endian is more useful in applications moving networking
type traffic or a fair amount of graphics processing. Little endian
is handy if you are porting applications from Windows or a lot of
your software is written in little endian.
That's my $.02.
-Steve
--
Steven J. Hill - Embedded SW Engineer
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Questions?
2002-03-06 18:20 ` Questions? Steven J. Hill
@ 2002-03-06 18:43 ` Marc Karasek
2002-03-06 18:54 ` Questions? Hartvig Ekner
0 siblings, 1 reply; 19+ messages in thread
From: Marc Karasek @ 2002-03-06 18:43 UTC (permalink / raw)
To: sjhill; +Cc: Linux MIPS
No, I have been involved with too many sorties in the war already. I
was just asking if there was any issues with one side or the other from
a purely technical aspect.
On Wed, 2002-03-06 at 13:20, Steven J. Hill wrote:
> Marc Karasek wrote:
> >
> > How many of you are involved with embedded linux development using a
> > MIPS processor?
> >
> A fair number of us. Over a hundred easily.
>
> > What endianess have you chosen for your project and why?
> >
> You don't really want to start this holy war, do you? That aside,
> usually big endian is more useful in applications moving networking
> type traffic or a fair amount of graphics processing. Little endian
> is handy if you are porting applications from Windows or a lot of
> your software is written in little endian.
>
> That's my $.02.
>
> -Steve
>
> --
> Steven J. Hill - Embedded SW Engineer
--
/*************************
Marc Karasek
Sr. Firmware Engineer
iVivity Inc.
marc_karasek@ivivity.com
678.990.1550 x238
678.990.1551 Fax
*************************/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Questions?
2002-03-06 18:43 ` Questions? Marc Karasek
@ 2002-03-06 18:54 ` Hartvig Ekner
2002-03-06 18:54 ` Questions? Hartvig Ekner
0 siblings, 1 reply; 19+ messages in thread
From: Hartvig Ekner @ 2002-03-06 18:54 UTC (permalink / raw)
To: Marc Karasek; +Cc: sjhill, Linux MIPS
It also depends on which new drivers you expect to use and thus need to
port from the x86 world. I can certainly tell you that we always start
off with LE for driver porting, for obvious reasons (x86, PCI), and then
go BE after that.
/Hartvig
Marc Karasek writes:
>
> No, I have been involved with too many sorties in the war already. I
> was just asking if there was any issues with one side or the other from
> a purely technical aspect.
>
> On Wed, 2002-03-06 at 13:20, Steven J. Hill wrote:
> > Marc Karasek wrote:
> > >
> > > How many of you are involved with embedded linux development using a
> > > MIPS processor?
> > >
> > A fair number of us. Over a hundred easily.
> >
> > > What endianess have you chosen for your project and why?
> > >
> > You don't really want to start this holy war, do you? That aside,
> > usually big endian is more useful in applications moving networking
> > type traffic or a fair amount of graphics processing. Little endian
> > is handy if you are porting applications from Windows or a lot of
> > your software is written in little endian.
> >
> > That's my $.02.
> >
> > -Steve
> >
> > --
> > Steven J. Hill - Embedded SW Engineer
> --
> /*************************
> Marc Karasek
> Sr. Firmware Engineer
> iVivity Inc.
> marc_karasek@ivivity.com
> 678.990.1550 x238
> 678.990.1551 Fax
> *************************/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Questions?
2002-03-06 18:54 ` Questions? Hartvig Ekner
@ 2002-03-06 18:54 ` Hartvig Ekner
0 siblings, 0 replies; 19+ messages in thread
From: Hartvig Ekner @ 2002-03-06 18:54 UTC (permalink / raw)
To: Marc Karasek; +Cc: sjhill, Linux MIPS
It also depends on which new drivers you expect to use and thus need to
port from the x86 world. I can certainly tell you that we always start
off with LE for driver porting, for obvious reasons (x86, PCI), and then
go BE after that.
/Hartvig
Marc Karasek writes:
>
> No, I have been involved with too many sorties in the war already. I
> was just asking if there was any issues with one side or the other from
> a purely technical aspect.
>
> On Wed, 2002-03-06 at 13:20, Steven J. Hill wrote:
> > Marc Karasek wrote:
> > >
> > > How many of you are involved with embedded linux development using a
> > > MIPS processor?
> > >
> > A fair number of us. Over a hundred easily.
> >
> > > What endianess have you chosen for your project and why?
> > >
> > You don't really want to start this holy war, do you? That aside,
> > usually big endian is more useful in applications moving networking
> > type traffic or a fair amount of graphics processing. Little endian
> > is handy if you are porting applications from Windows or a lot of
> > your software is written in little endian.
> >
> > That's my $.02.
> >
> > -Steve
> >
> > --
> > Steven J. Hill - Embedded SW Engineer
> --
> /*************************
> Marc Karasek
> Sr. Firmware Engineer
> iVivity Inc.
> marc_karasek@ivivity.com
> 678.990.1550 x238
> 678.990.1551 Fax
> *************************/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Questions?
2002-03-06 17:25 Questions? Marc Karasek
2002-03-06 18:20 ` Questions? Steven J. Hill
@ 2002-03-06 19:06 ` Mike McDonald
2002-03-06 19:44 ` Questions? Matthew Dharm
` (3 subsequent siblings)
5 siblings, 0 replies; 19+ messages in thread
From: Mike McDonald @ 2002-03-06 19:06 UTC (permalink / raw)
To: Marc Karasek; +Cc: Linux MIPS
>Subject: Questions?
>From: Marc Karasek <marc_karasek@ivivity.com>
>To: Linux MIPS <linux-mips@oss.sgi.com>
>Date: 06 Mar 2002 12:25:11 -0500
>What endianess have you chosen for your project and why?
LE. That's all the NEC VR41XX support so I had no choice.
Mike McDonald
mikemac@mikemac.com
^ permalink raw reply [flat|nested] 19+ messages in thread* RE: Questions?
2002-03-06 17:25 Questions? Marc Karasek
2002-03-06 18:20 ` Questions? Steven J. Hill
2002-03-06 19:06 ` Questions? Mike McDonald
@ 2002-03-06 19:44 ` Matthew Dharm
2002-03-06 20:32 ` Questions? Bradley D. LaRonde
` (2 subsequent siblings)
5 siblings, 0 replies; 19+ messages in thread
From: Matthew Dharm @ 2002-03-06 19:44 UTC (permalink / raw)
To: Marc Karasek, Linux MIPS
My company develops embedded MIPS systems, and Linux is one of our
supported operating systems.
We chose big-endian, mostly because it seemed the right choice given
the state of the tree. Some customers have recompiled our code to run
little-endian with little problem, tho.
Matt
--
Matthew D. Dharm Senior Software Designer
Momentum Computer Inc. 1815 Aston Ave. Suite 107
(760) 431-8663 X-115 Carlsbad, CA 92008-7310
Momentum Works For You www.momenco.com
> -----Original Message-----
> From: owner-linux-mips@oss.sgi.com
> [mailto:owner-linux-mips@oss.sgi.com]On Behalf Of Marc Karasek
> Sent: Wednesday, March 06, 2002 9:25 AM
> To: Linux MIPS
> Subject: Questions?
>
>
> I have some general questions for all:
>
> How many of you are involved with embedded linux development using a
> MIPS processor?
>
> What endianess have you chosen for your project and why?
>
> If you have not guessed it, I am involved with a MIPS/Linux embedded
> project and we are trying to determine if there are any
> pros or cons in
> one endianess over the other.
>
> --
> /*************************
> Marc Karasek
> Sr. Firmware Engineer
> iVivity Inc.
> marc_karasek@ivivity.com
> 678.990.1550 x238
> 678.990.1551 Fax
> *************************/
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Questions?
2002-03-06 17:25 Questions? Marc Karasek
` (2 preceding siblings ...)
2002-03-06 19:44 ` Questions? Matthew Dharm
@ 2002-03-06 20:32 ` Bradley D. LaRonde
2002-03-07 10:59 ` Questions? Dominic Sweetman
2002-03-07 13:07 ` Questions? Ralf Baechle
5 siblings, 0 replies; 19+ messages in thread
From: Bradley D. LaRonde @ 2002-03-06 20:32 UTC (permalink / raw)
To: Marc Karasek, Linux MIPS
----- Original Message -----
From: "Marc Karasek" <marc_karasek@ivivity.com>
To: "Linux MIPS" <linux-mips@oss.sgi.com>
Sent: Wednesday, March 06, 2002 12:25 PM
Subject: Questions?
> What endianess have you chosen for your project
little
> and why?
1. to match endianness with my x86 cross-dev build system
2. hardware quirks
Regards,
Brad
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Questions?
2002-03-06 17:25 Questions? Marc Karasek
` (3 preceding siblings ...)
2002-03-06 20:32 ` Questions? Bradley D. LaRonde
@ 2002-03-07 10:59 ` Dominic Sweetman
2002-03-07 13:07 ` Questions? Ralf Baechle
5 siblings, 0 replies; 19+ messages in thread
From: Dominic Sweetman @ 2002-03-07 10:59 UTC (permalink / raw)
To: Marc Karasek; +Cc: Linux MIPS
Marc Karasek (marc_karasek@ivivity.com) writes:
> What endianess have you chosen for your project and why?
The MIPS world is irredemiably split, and the pull between SGI
(always big-endian, M68000 heritage and Sun compatibility) and Linux'
tendency to see the x86 as the universe has left Linux/MIPS split too.
As software tool and prototyping board supplier, we just know that
everything we do has to work either way.
If you can change that, it would be great! :-)
--
Dominic Sweetman,
Algorithmics Ltd
The Fruit Farm, Ely Road, Chittering, CAMBS CB5 9PH, ENGLAND
phone: +44 1223 706200 / fax: +44 1223 706250 / direct: +44 1223 706205
http://www.algor.co.uk
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Questions?
2002-03-06 17:25 Questions? Marc Karasek
` (4 preceding siblings ...)
2002-03-07 10:59 ` Questions? Dominic Sweetman
@ 2002-03-07 13:07 ` Ralf Baechle
2002-03-07 13:11 ` Questions? Geert Uytterhoeven
` (2 more replies)
5 siblings, 3 replies; 19+ messages in thread
From: Ralf Baechle @ 2002-03-07 13:07 UTC (permalink / raw)
To: Marc Karasek; +Cc: Linux MIPS
On Wed, Mar 06, 2002 at 12:25:11PM -0500, Marc Karasek wrote:
>
> How many of you are involved with embedded linux development using a
> MIPS processor?
>
> What endianess have you chosen for your project and why?
>
> If you have not guessed it, I am involved with a MIPS/Linux embedded
> project and we are trying to determine if there are any pros or cons in
> one endianess over the other.
The MIPS ABI only covers big endian systems - every "real" MIPS UNIX
system is big endian. Everything else is a GNU extension. There is
hardly any reason to choose a particular byteorder as usually endianess
swapping takes so little CPU time that it isn't even meassurable but so
I'm told there are exceptions. If portability of software you're
going to write wrt. external data representation (disk or network) is
of any importance then I suggest you use a system of the opposite
endianess which trip problems much faster.
Ralf
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Questions?
2002-03-07 13:07 ` Questions? Ralf Baechle
@ 2002-03-07 13:11 ` Geert Uytterhoeven
2002-03-07 13:18 ` Questions? Ralf Baechle
2002-03-07 17:56 ` Questions? Richard Hodges
2002-03-08 9:58 ` Questions? Dominic Sweetman
2 siblings, 1 reply; 19+ messages in thread
From: Geert Uytterhoeven @ 2002-03-07 13:11 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Marc Karasek, Linux MIPS
On Thu, 7 Mar 2002, Ralf Baechle wrote:
> On Wed, Mar 06, 2002 at 12:25:11PM -0500, Marc Karasek wrote:
> > How many of you are involved with embedded linux development using a
> > MIPS processor?
> >
> > What endianess have you chosen for your project and why?
> >
> > If you have not guessed it, I am involved with a MIPS/Linux embedded
> > project and we are trying to determine if there are any pros or cons in
> > one endianess over the other.
>
> The MIPS ABI only covers big endian systems - every "real" MIPS UNIX
> system is big endian. Everything else is a GNU extension. There is
> hardly any reason to choose a particular byteorder as usually endianess
> swapping takes so little CPU time that it isn't even meassurable but so
> I'm told there are exceptions. If portability of software you're
> going to write wrt. external data representation (disk or network) is
> of any importance then I suggest you use a system of the opposite
> endianess which trip problems much faster.
I really like the last part! ;-)
BTW, you forgot to mention to go for a full 64-bit port, to trip even more
problems faster :-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Questions?
2002-03-07 13:11 ` Questions? Geert Uytterhoeven
@ 2002-03-07 13:18 ` Ralf Baechle
0 siblings, 0 replies; 19+ messages in thread
From: Ralf Baechle @ 2002-03-07 13:18 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Marc Karasek, Linux MIPS
On Thu, Mar 07, 2002 at 02:11:50PM +0100, Geert Uytterhoeven wrote:
> > The MIPS ABI only covers big endian systems - every "real" MIPS UNIX
> > system is big endian. Everything else is a GNU extension. There is
> > hardly any reason to choose a particular byteorder as usually endianess
> > swapping takes so little CPU time that it isn't even meassurable but so
> > I'm told there are exceptions. If portability of software you're
> > going to write wrt. external data representation (disk or network) is
> > of any importance then I suggest you use a system of the opposite
> > endianess which trip problems much faster.
>
> I really like the last part! ;-)
>
> BTW, you forgot to mention to go for a full 64-bit port, to trip even more
> problems faster :-)
Fortunately in practice that hasn't been a minefield as big as you'd imagine.
Ralf
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Questions?
2002-03-07 13:07 ` Questions? Ralf Baechle
2002-03-07 13:11 ` Questions? Geert Uytterhoeven
@ 2002-03-07 17:56 ` Richard Hodges
2002-03-08 9:58 ` Questions? Dominic Sweetman
2 siblings, 0 replies; 19+ messages in thread
From: Richard Hodges @ 2002-03-07 17:56 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Linux MIPS
On Thu, 7 Mar 2002, Ralf Baechle wrote:
> The MIPS ABI only covers big endian systems - every "real" MIPS UNIX
> system is big endian. Everything else is a GNU extension. There is
> hardly any reason to choose a particular byteorder as usually endianess
> swapping takes so little CPU time that it isn't even meassurable but so
> I'm told there are exceptions.
To me, byte swapping on MIPS actually seems rather expensive. The code
for htonl (linux/byteorder/swab.h) ends up something like this:
srl $5,$4,8
andi $5,$5,0xff00
srl $2,$4,24
andi $3,$4,0xff00
or $2,$2,$5
sll $3,$3,8
or $2,$2,$3
sll $4,$4,24
This may not be an issue if it is only needed a few times per packet, but
my system must byte-swap (LE to BE) about 500KB (or 4mb) per second.
Actually, I save a bit of work by combining the byte swapping with the
memory move, just after copy_from_user, and looks something like:
unsigned char a, b, c, d, *mptr;
a = mptr[0];
b = mptr[1];
c = mptr[2];
d = mptr[3];
mptr[0] = d;
mptr[1] = c;
mptr[2] = b;
mptr[3] = a;
This method works, but it is still 8 instructions per word. Yuck! Does
anyone know of a _decent_ way to handle this on MIPS?
All the best,
-Richard
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Questions?
2002-03-07 13:07 ` Questions? Ralf Baechle
2002-03-07 13:11 ` Questions? Geert Uytterhoeven
2002-03-07 17:56 ` Questions? Richard Hodges
@ 2002-03-08 9:58 ` Dominic Sweetman
2 siblings, 0 replies; 19+ messages in thread
From: Dominic Sweetman @ 2002-03-08 9:58 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Marc Karasek, Linux MIPS
Ralf Baechle (ralf@oss.sgi.com) writes:
> The MIPS ABI only covers big endian systems - every "real" MIPS UNIX
> system is big endian.
Except Decstations. And Sony NeWS (remember that one). And anything
running on those NEC Vr41xx systems which were designed for WinCE and
don't run big-endian at all. There never was a consensus...
Mapping the MIPS ABI to little-endian presents no problems, as far as
I know: obviously since it's a binary compatibility standard it has to
make a choice...
> There is hardly any reason to choose a particular byteorder as
> usually endianess swapping takes so little CPU time that it isn't
> even meassurable but so I'm told there are exceptions.
I think it's often done for software-portability reasons; sometimes
because some hardware works both ways but has some irritating flaw in
its less-favoured organisation.
System software (kernels, libraries) tends to work both ways, because
it's written by people who thought about it. Huge applications which
have only ever run on x86 and friends often don't work.
Finding the problems faster is a counsel of perfection: in practice, a
lot of us just want something that works, tomorrow.
Swapping probably is an unmeasurable load: even if it takes 8-10
instructions per word on a 500MHz CPU that's 200Mbytes/s. But it is
ugly, particularly when it's required to restore correct byte sequence
because of a naive hardware interface (one, for example, which
connects the MIPS CPU data lines to the same-numbered PCI ones...)
So there are arguments on both sides, and players in both camps. I
believe it's too late to corral all MIPS/Linux activity into one
endianness or the other.
Embrace bi-endianness!
--
Dominic Sweetman,
Algorithmics Ltd
The Fruit Farm, Ely Road, Chittering, CAMBS CB5 9PH, ENGLAND
phone: +44 1223 706200 / fax: +44 1223 706250 / direct: +44 1223 706205
http://www.algor.co.uk
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: Questions?
@ 2002-03-06 20:40 Marc Karasek
2002-03-06 20:41 ` Questions? Matthew Dharm
0 siblings, 1 reply; 19+ messages in thread
From: Marc Karasek @ 2002-03-06 20:40 UTC (permalink / raw)
To: 'Matthew Dharm', Linux MIPS
What kernel/tools do you provide?
-----Original Message-----
From: Matthew Dharm [mailto:mdharm@momenco.com]
Sent: Wednesday, March 06, 2002 2:45 PM
To: Marc Karasek; Linux MIPS
Subject: RE: Questions?
My company develops embedded MIPS systems, and Linux is one of our
supported operating systems.
We chose big-endian, mostly because it seemed the right choice given
the state of the tree. Some customers have recompiled our code to run
little-endian with little problem, tho.
Matt
--
Matthew D. Dharm Senior Software Designer
Momentum Computer Inc. 1815 Aston Ave. Suite 107
(760) 431-8663 X-115 Carlsbad, CA 92008-7310
Momentum Works For You www.momenco.com
> -----Original Message-----
> From: owner-linux-mips@oss.sgi.com
> [mailto:owner-linux-mips@oss.sgi.com]On Behalf Of Marc Karasek
> Sent: Wednesday, March 06, 2002 9:25 AM
> To: Linux MIPS
> Subject: Questions?
>
>
> I have some general questions for all:
>
> How many of you are involved with embedded linux development using a
> MIPS processor?
>
> What endianess have you chosen for your project and why?
>
> If you have not guessed it, I am involved with a MIPS/Linux embedded
> project and we are trying to determine if there are any
> pros or cons in
> one endianess over the other.
>
> --
> /*************************
> Marc Karasek
> Sr. Firmware Engineer
> iVivity Inc.
> marc_karasek@ivivity.com
> 678.990.1550 x238
> 678.990.1551 Fax
> *************************/
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: Questions?
2002-03-06 20:40 Questions? Marc Karasek
@ 2002-03-06 20:41 ` Matthew Dharm
0 siblings, 0 replies; 19+ messages in thread
From: Matthew Dharm @ 2002-03-06 20:41 UTC (permalink / raw)
To: Marc Karasek, Linux MIPS
We use kernel 2.4.17 right now (upgrade to 2.4.18 is planned), and we
use the toolchain that H.J. Liu put together (and is located on
oss.sgi.com).
Matt
--
Matthew D. Dharm Senior Software Designer
Momentum Computer Inc. 1815 Aston Ave. Suite 107
(760) 431-8663 X-115 Carlsbad, CA 92008-7310
Momentum Works For You www.momenco.com
> -----Original Message-----
> From: Marc Karasek [mailto:marc_karasek@ivivity.com]
> Sent: Wednesday, March 06, 2002 12:40 PM
> To: 'Matthew Dharm'; Linux MIPS
> Subject: RE: Questions?
>
>
> What kernel/tools do you provide?
>
> -----Original Message-----
> From: Matthew Dharm [mailto:mdharm@momenco.com]
> Sent: Wednesday, March 06, 2002 2:45 PM
> To: Marc Karasek; Linux MIPS
> Subject: RE: Questions?
>
>
> My company develops embedded MIPS systems, and Linux is one of our
> supported operating systems.
>
> We chose big-endian, mostly because it seemed the right choice given
> the state of the tree. Some customers have recompiled our
> code to run
> little-endian with little problem, tho.
>
> Matt
>
> --
> Matthew D. Dharm Senior Software Designer
> Momentum Computer Inc. 1815 Aston Ave.
> Suite 107
> (760) 431-8663 X-115 Carlsbad, CA 92008-7310
> Momentum Works For You www.momenco.com
>
> > -----Original Message-----
> > From: owner-linux-mips@oss.sgi.com
> > [mailto:owner-linux-mips@oss.sgi.com]On Behalf Of Marc Karasek
> > Sent: Wednesday, March 06, 2002 9:25 AM
> > To: Linux MIPS
> > Subject: Questions?
> >
> >
> > I have some general questions for all:
> >
> > How many of you are involved with embedded linux
> development using a
> > MIPS processor?
> >
> > What endianess have you chosen for your project and why?
> >
> > If you have not guessed it, I am involved with a
> MIPS/Linux embedded
> > project and we are trying to determine if there are any
> > pros or cons in
> > one endianess over the other.
> >
> > --
> > /*************************
> > Marc Karasek
> > Sr. Firmware Engineer
> > iVivity Inc.
> > marc_karasek@ivivity.com
> > 678.990.1550 x238
> > 678.990.1551 Fax
> > *************************/
> >
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: Questions?
@ 2002-03-07 19:19 Siders, Keith
2002-03-07 21:00 ` Questions? Richard Hodges
0 siblings, 1 reply; 19+ messages in thread
From: Siders, Keith @ 2002-03-07 19:19 UTC (permalink / raw)
To: Linux MIPS
You can get that down to 5 instructions. You could either use a typecast, or
for portability, use a union definition. For that matter you could even
typecast *mptr as a pointer to the union and extract the data from the
string however you choose. But it still takes 5 instructions, unless you're
pulling the data into another buffer, in which case you're down to 4.
Keith
-> -----Original Message-----
-> From: Richard Hodges [mailto:rh@matriplex.com]
-> Sent: Thursday, March 07, 2002 11:57 AM
-> To: Ralf Baechle
-> Cc: Linux MIPS
-> Subject: Re: Questions?
->
->
-> On Thu, 7 Mar 2002, Ralf Baechle wrote:
->
-> > The MIPS ABI only covers big endian systems - every "real"
-> MIPS UNIX
-> > system is big endian. Everything else is a GNU extension.
-> There is
-> > hardly any reason to choose a particular byteorder as
-> usually endianess
-> > swapping takes so little CPU time that it isn't even
-> meassurable but so
-> > I'm told there are exceptions.
->
-> To me, byte swapping on MIPS actually seems rather
-> expensive. The code
-> for htonl (linux/byteorder/swab.h) ends up something like this:
->
-> srl $5,$4,8
-> andi $5,$5,0xff00
-> srl $2,$4,24
-> andi $3,$4,0xff00
-> or $2,$2,$5
-> sll $3,$3,8
-> or $2,$2,$3
-> sll $4,$4,24
->
-> This may not be an issue if it is only needed a few times
-> per packet, but
-> my system must byte-swap (LE to BE) about 500KB (or 4mb) per second.
-> Actually, I save a bit of work by combining the byte
-> swapping with the
-> memory move, just after copy_from_user, and looks something like:
->
-> unsigned char a, b, c, d, *mptr;
-> a = mptr[0];
-> b = mptr[1];
-> c = mptr[2];
-> d = mptr[3];
-> mptr[0] = d;
-> mptr[1] = c;
-> mptr[2] = b;
-> mptr[3] = a;
->
-> This method works, but it is still 8 instructions per word.
-> Yuck! Does
-> anyone know of a _decent_ way to handle this on MIPS?
->
-> All the best,
->
-> -Richard
->
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: Questions?
2002-03-07 19:19 Questions? Siders, Keith
@ 2002-03-07 21:00 ` Richard Hodges
0 siblings, 0 replies; 19+ messages in thread
From: Richard Hodges @ 2002-03-07 21:00 UTC (permalink / raw)
To: Siders, Keith; +Cc: Linux MIPS
On Thu, 7 Mar 2002, Siders, Keith wrote:
> You can get that down to 5 instructions. You could either use a typecast, or
> for portability, use a union definition. For that matter you could even
> typecast *mptr as a pointer to the union and extract the data from the
> string however you choose. But it still takes 5 instructions, unless you're
> pulling the data into another buffer, in which case you're down to 4.
Which 5 instructions are those? For htonl from memory, the only sequence
I can think of is the "obvious" one of lbu/shift (7 instructions). And
for swapping BE-LE in memory (an important thing for me), I do not see any
method better than the "obvious" one I mentioned earlier:
90c50000 lbu a1,0(a2)
90c40001 lbu a0,1(a2)
90c30002 lbu v1,2(a2)
90c20003 lbu v0,3(a2)
a0c20000 sb v0,0(a2)
a0c30001 sb v1,1(a2)
a0c40002 sb a0,2(a2)
a0c50003 sb a1,3(a2)
Thanks,
-Richard
> -> From: Richard Hodges [mailto:rh@matriplex.com]
> -> To me, byte swapping on MIPS actually seems rather
> -> expensive. The code
> -> for htonl (linux/byteorder/swab.h) ends up something like this:
> ->
> -> srl $5,$4,8
> -> andi $5,$5,0xff00
> -> srl $2,$4,24
> -> andi $3,$4,0xff00
> -> or $2,$2,$5
> -> sll $3,$3,8
> -> or $2,$2,$3
> -> sll $4,$4,24
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: Questions?
@ 2002-03-07 21:44 Siders, Keith
0 siblings, 0 replies; 19+ messages in thread
From: Siders, Keith @ 2002-03-07 21:44 UTC (permalink / raw)
To: 'Richard Hodges'; +Cc: Linux MIPS
Hmm, assembly or C? Your original message had examples in both. In C the
large part is the definitions in the union.
If you define
struct le_bitfield {
unsigned long low:8;
unsigned long lmid:8;
unsigned long hmid:8;
unsigned long high:8;
};
struct be_bitfield {
unsigned long high:8;
unsigned long hmid:8;
unsigned long lmid:8;
unsigned long low:8;
};
union byte_swap {
unsigned long original;
struct le_bitfield le;
struct be_bitfield be;
}swapper;
Now you can use your previous char pointer
swapper.original = *((unsigned long *)mptr);
mptr[0] = swapper.le.low;
mptr[1] = swapper.le.lmid;
mptr[2] = swapper.le.hmid;
mptr[3] = swapper.le.high;
5 instructions in C.
To swap the other way, just use swapper.be.xxxx. If this still translates to
8 assembly instructions (or worse), oh well... just trying to help. ;)
-> -----Original Message-----
-> From: Richard Hodges [mailto:rh@matriplex.com]
-> Sent: Thursday, March 07, 2002 3:00 PM
-> To: Siders, Keith
-> Cc: Linux MIPS
-> Subject: RE: Questions?
->
->
-> On Thu, 7 Mar 2002, Siders, Keith wrote:
->
-> > You can get that down to 5 instructions. You could either
-> use a typecast, or
-> > for portability, use a union definition. For that matter
-> you could even
-> > typecast *mptr as a pointer to the union and extract the
-> data from the
-> > string however you choose. But it still takes 5
-> instructions, unless you're
-> > pulling the data into another buffer, in which case you're
-> down to 4.
->
-> Which 5 instructions are those? For htonl from memory, the
-> only sequence
-> I can think of is the "obvious" one of lbu/shift (7
-> instructions). And
-> for swapping BE-LE in memory (an important thing for me), I
-> do not see any
-> method better than the "obvious" one I mentioned earlier:
->
-> 90c50000 lbu a1,0(a2)
-> 90c40001 lbu a0,1(a2)
-> 90c30002 lbu v1,2(a2)
-> 90c20003 lbu v0,3(a2)
-> a0c20000 sb v0,0(a2)
-> a0c30001 sb v1,1(a2)
-> a0c40002 sb a0,2(a2)
-> a0c50003 sb a1,3(a2)
->
-> Thanks,
->
-> -Richard
->
-> > -> From: Richard Hodges [mailto:rh@matriplex.com]
->
-> > -> To me, byte swapping on MIPS actually seems rather
-> > -> expensive. The code
-> > -> for htonl (linux/byteorder/swab.h) ends up something like this:
-> > ->
-> > -> srl $5,$4,8
-> > -> andi $5,$5,0xff00
-> > -> srl $2,$4,24
-> > -> andi $3,$4,0xff00
-> > -> or $2,$2,$5
-> > -> sll $3,$3,8
-> > -> or $2,$2,$3
-> > -> sll $4,$4,24
->
->
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2002-03-08 10:59 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-06 17:25 Questions? Marc Karasek
2002-03-06 18:20 ` Questions? Steven J. Hill
2002-03-06 18:43 ` Questions? Marc Karasek
2002-03-06 18:54 ` Questions? Hartvig Ekner
2002-03-06 18:54 ` Questions? Hartvig Ekner
2002-03-06 19:06 ` Questions? Mike McDonald
2002-03-06 19:44 ` Questions? Matthew Dharm
2002-03-06 20:32 ` Questions? Bradley D. LaRonde
2002-03-07 10:59 ` Questions? Dominic Sweetman
2002-03-07 13:07 ` Questions? Ralf Baechle
2002-03-07 13:11 ` Questions? Geert Uytterhoeven
2002-03-07 13:18 ` Questions? Ralf Baechle
2002-03-07 17:56 ` Questions? Richard Hodges
2002-03-08 9:58 ` Questions? Dominic Sweetman
-- strict thread matches above, loose matches on Subject: below --
2002-03-06 20:40 Questions? Marc Karasek
2002-03-06 20:41 ` Questions? Matthew Dharm
2002-03-07 19:19 Questions? Siders, Keith
2002-03-07 21:00 ` Questions? Richard Hodges
2002-03-07 21:44 Questions? Siders, Keith
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox