Address sizes on 64-bit MIPS targets

Paul Koning pkoning@equallogic.com
Wed Mar 2 16:42:00 GMT 2005


>>>>> "Thiemo" == Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> writes:

 >> ...
 >> It depends.  You only get wrap-around when running in user mode.
 >> n32 code running in kernel or supervisor mode will not wrap
 >> around, so the results are sensitive to processor mode.
 >> 
 >> And I'm not sure how predicatable the behaviour is for all 64-bit
 >> processors.  The MIPS64 spec guarantees wrap-around for user mode
 >> programs when UX=0, but (for example) the description of
 >> supervisor and kernel addressing in the VR4100 manual says:
 >> 
 >> Usually, it is impossible for 32-bit mode programs to generate
 >> invalid addresses.  In an operation of base register + offset for
 >> addressing, however, a two's complement overflow may occur,
 >> causing an invalid address.  Note that the result becomes
 >> undefined.
 >> 
 >> But maybe I'm being overly influenced by that ;)

 Thiemo> We have (potentially) two cases where all of this is used. A
 Thiemo> (currently not existing) n32 userland non-PIC mode, and n32
 Thiemo> non-PIC kernel mode.  In both cases, addresses which could
 Thiemo> wrap-around are invalid. There's just not point in handling
 Thiemo> them better than we already do.

I'm a bit confused about which cases are being talked about here.
Much of the discussion is about N32, and I'd agree that addresses
bigger than 32 bits by definition have no meaning there.

On the other hand, at some points N64 was mentioned.  N64 has a flat,
non-segmented, address space.  Anything other than 64 bit arithmetic
in the macro expansions would seem to be wrong if you're assembling
for N64.  So for example:

 >> Richard Sandiford wrote:
 >> However, if the sequence is:
 >> 
 >>         dla     $2,0xa8000000000000
 >>         lw      $2,0x100000($2)
 >> 
 >> then the lw will use 32-bit address arithmetic:
 >> 
 >>         lui     $1,0x10
 >>         addu    $1,$1,$2
 >>         lw      $2,0($1)
 >> 
 >> and the behaviour will be unpredictable.

that addu should be a daddu in N64.

     paul



More information about the Binutils mailing list