linux-mips-fnet
[Top] [All Lists]

Re: M700 partition problem

To: linux-mips@fnet.fr
Subject: Re: M700 partition problem
From: Per Fogelstrom <pefo@enea.se>
Date: Thu, 18 Apr 1996 19:03:37 +0200 (MET DST)
In-reply-to: <199604181445.QAA07524@informatik.uni-koblenz.de> from "Wayne Hodgen" at Apr 18, 96 04:43:53 pm
> 
> Hi,
> 
> > You need to do the same as alphas do. Mipses can't load unaligned without
> > using special instructions or load a byte at  a time and merge them.
> > 
> > I ran into this when porting XFree86 to my 4000 running NetBSD.
> 
> Yeah, I already worked that out, but as I wrote at the bottom of the first
> mail, I can't do MIPS assembler off the top of my head (yet ;) and my
> book is missing. Maybe I phrased it wrong, can you tell me the assembler
> intruction to do the unaligned load? Thats what I need to know.
> 

Ok!

#define ldunaligned(x) \  
        ({ int __result; \
        __asm__("lwr    %0,0(%1);lwl    %0,3(%1)" \
                : "&=r" (__result) : "r" (x)); __result; })

        int nn = ldunaligned(*arbitrary address*);

You have to swap "lwr" and "lwl" if you run in big endian mode.
And the order too perhaps, if the last one ends up as a nop if "x" is
aligned.

Per

<Prev in Thread] Current Thread [Next in Thread>