MIPS: Fix sign-extension bug in 32-bit kernel on 32-bit hardware.
authorRalf Baechle <ralf@linux-mips.org>
Thu, 30 Apr 2009 00:16:19 +0000 (02:16 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 14 May 2009 12:50:29 +0000 (13:50 +0100)
Probably nobody does arithmetic on cp0 register values so this has never
bitten.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/mipsregs.h

index 0ef30c81fea6daa75d72e8117f9f115c00c2d5e2..32ef8bec5c8590719bb67479de79870761268779 100644 (file)
@@ -728,8 +728,8 @@ do {                                                                        \
                        ".set\tmips64\n\t"                              \
                        "dmfc0\t%M0, " #source "\n\t"                   \
                        "dsll\t%L0, %M0, 32\n\t"                        \
-                       "dsrl\t%M0, %M0, 32\n\t"                        \
-                       "dsrl\t%L0, %L0, 32\n\t"                        \
+                       "dsra\t%M0, %M0, 32\n\t"                        \
+                       "dsra\t%L0, %L0, 32\n\t"                        \
                        ".set\tmips0"                                   \
                        : "=r" (__val));                                \
        else                                                            \
@@ -737,8 +737,8 @@ do {                                                                        \
                        ".set\tmips64\n\t"                              \
                        "dmfc0\t%M0, " #source ", " #sel "\n\t"         \
                        "dsll\t%L0, %M0, 32\n\t"                        \
-                       "dsrl\t%M0, %M0, 32\n\t"                        \
-                       "dsrl\t%L0, %L0, 32\n\t"                        \
+                       "dsra\t%M0, %M0, 32\n\t"                        \
+                       "dsra\t%L0, %L0, 32\n\t"                        \
                        ".set\tmips0"                                   \
                        : "=r" (__val));                                \
        local_irq_restore(__flags);                                     \