linux-mips
[Top] [All Lists]

Re: load_unaligned() and "uld" instruction

To: Jun Sun <jsun@mvista.com>
Subject: Re: load_unaligned() and "uld" instruction
From: Dominic Sweetman <dom@algor.co.uk>
Date: Mon, 25 Sep 2000 22:16:33 +0100 (GMT/BST)
Cc: linux-mips@oss.sgi.com, linux-mips@fnet.fr
In-reply-to: <39CF9DFC.F30B302B@mvista.com>
References: <39CF9DFC.F30B302B@mvista.com>
Sender: owner-linux-mips@oss.sgi.com
Jun Sun (jsun@mvista.com) writes:

> The USB sub-system uses "unaligned.h" file to access unaligned data. 
> All the unaligned data access functions depend on "uld" and "usw"
> instructions, which are not available on many CPUs.

You won't find the instruction 'uld' in *any* MIPS CPU.

uld is an assembler macro-instruction translating into a 

  ldl
  ldr

pair (the instructions are called load-double-left and
load-double-right).  The exact translation depends on whether you're
running big-endian or little-endian... but the 32-bit version on a
big-endian CPU is that 

  ulw $1, <address>

is assembled as

  lwl $1, <address>
  lwr $1, <address+3>

The way that the load-left and load-right work together is kind of
tricky to get your head round.  

So far as I know, all 64-bit MIPS CPUs implement ldl/ldr and the store
equivalents.  MIPS patented these instructions, so clones like Lexra's
don't implement the 32-bit versions (lwl, lwr etc).

-- 
Dominic Sweetman
Algorithmics Ltd
The Fruit Farm, Ely Road, Chittering, CAMBS CB5 9PH, ENGLAND
phone: +44 1223 706200 / fax: +44 1223 706250 / http://www.algor.co.uk

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