>
> 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
|