Skip to content

Commit bedf142

Browse files
buytenhRussell King
authored andcommitted
[ARM] 3118/1: fix and reenable nwfpe extended precision emulation for big-endian
Patch from Lennert Buytenhek nwfpe extended precision emulation used to be broken on big-endian and was therefore disabled. This patch fixes nwfpe so that it copies extended precision floats to/from userspace in the proper word order (similar to patch raspberrypi#2046, see the description of that patch for an explanation) and reenables the Kconfig option. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 06c03ca commit bedf142

4 files changed

Lines changed: 22 additions & 7 deletions

File tree

‎arch/arm/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ config FPE_NWFPE
585585

586586
config FPE_NWFPE_XP
587587
bool "Support extended precision"
588-
depends on FPE_NWFPE && !CPU_BIG_ENDIAN
588+
depends on FPE_NWFPE
589589
help
590590
Say Y to include 80-bit support in the kernel floating-point
591591
emulator. Otherwise, only 32 and 64-bit support is compiled in.

‎arch/arm/nwfpe/fpa11.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef union tagFPREG {
6060
#ifdef CONFIG_FPE_NWFPE_XP
6161
floatx80 fExtended;
6262
#else
63-
int padding[3];
63+
u32 padding[3];
6464
#endif
6565
} FPREG;
6666

‎arch/arm/nwfpe/fpa11_cpdt.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ static inline void loadExtended(const unsigned int Fn, const unsigned int __user
5959
p = (unsigned int *) &fpa11->fpreg[Fn].fExtended;
6060
fpa11->fType[Fn] = typeExtended;
6161
get_user(p[0], &pMem[0]); /* sign & exponent */
62+
#ifdef __ARMEB__
63+
get_user(p[1], &pMem[1]); /* ms bits */
64+
get_user(p[2], &pMem[2]); /* ls bits */
65+
#else
6266
get_user(p[1], &pMem[2]); /* ls bits */
6367
get_user(p[2], &pMem[1]); /* ms bits */
68+
#endif
6469
}
6570
#endif
6671

@@ -177,8 +182,13 @@ static inline void storeExtended(const unsigned int Fn, unsigned int __user *pMe
177182
}
178183

179184
put_user(val.i[0], &pMem[0]); /* sign & exp */
185+
#ifdef __ARMEB__
186+
put_user(val.i[1], &pMem[1]); /* msw */
187+
put_user(val.i[2], &pMem[2]);
188+
#else
180189
put_user(val.i[1], &pMem[2]);
181190
put_user(val.i[2], &pMem[1]); /* msw */
191+
#endif
182192
}
183193
#endif
184194

‎arch/arm/nwfpe/softfloat.h‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,17 @@ input or output the `floatx80' type will be defined.
5151
Software IEC/IEEE floating-point types.
5252
-------------------------------------------------------------------------------
5353
*/
54-
typedef unsigned long int float32;
55-
typedef unsigned long long float64;
54+
typedef u32 float32;
55+
typedef u64 float64;
5656
typedef struct {
57-
unsigned short high;
58-
unsigned short __padding;
59-
unsigned long long low;
57+
#ifdef __ARMEB__
58+
u16 __padding;
59+
u16 high;
60+
#else
61+
u16 high;
62+
u16 __padding;
63+
#endif
64+
u64 low;
6065
} floatx80;
6166

6267
/*

0 commit comments

Comments
 (0)