[Top] [All Lists]

Re: load_unaligned() and "uld" instruction

To: Jun Sun <>
Subject: Re: load_unaligned() and "uld" instruction
From: "Maciej W. Rozycki" <>
Date: Wed, 27 Sep 2000 12:06:31 +0200 (MET DST)
Cc: "Kevin D. Kissell" <>,, Dominic Sweetman <>,,
In-reply-to: <>
Organization: Technical University of Gdansk
On Tue, 26 Sep 2000, Jun Sun wrote:

> --- linux/include/asm-mips/unaligned.h.orig     Mon Sep 25 14:02:52 2000
> +++ linux/include/asm-mips/unaligned.h  Tue Sep 26 10:53:31 2000
> @@ -19,7 +19,7 @@
>  {
>         unsigned long long __res;
> -       __asm__("uld\t%0,(%1)"
> +       __asm__(".set\tmips3\n\tuld\t%0,(%1)"
>                 :"=&r" (__res)
>                 :"r" (__addr));

 Please don't.  Gcc already has means to generate proper unaligned
accesses.  See include/asm-alpha/unaligned.h for how to achieve them in a
portable way (i.e. using packed structs) without the problematic inline

 And please use ".set mips0" (or ".set push" and ".set pop",
appropriately) after using any ".set mips*" directive (or any other ".set"
directive to that matter) not to adversly affect any other code.  Improper
coding of such constructs bites R3K people badly.

 Better yet, configure your compiler appropriately and avoid switching ISA
levels in the code if at all possible.

+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+        e-mail:, PGP key available        +

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