aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-09 03:00:42 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-20 03:05:05 -0400
commit04ae9001719c3f0012d239a7c5aa4136f6b6541d (patch)
tree7fb5adf84fa359034100e672f92a21e42789313a
parenta5e4797b0f46819a74a7233825137ed5d2f51b51 (diff)
powerpc/math-emu: Fix decoding of some instructions
The decoding of some instructions such as fsqrt{s} was incorrect, using the wrong registers, and thus could not work. This fixes it and also adds a couple of place holders for missing instructions. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/math-emu/Makefile3
-rw-r--r--arch/powerpc/math-emu/fre.c11
-rw-r--r--arch/powerpc/math-emu/frsqrtes.c11
-rw-r--r--arch/powerpc/math-emu/math.c14
4 files changed, 34 insertions, 5 deletions
diff --git a/arch/powerpc/math-emu/Makefile b/arch/powerpc/math-emu/Makefile
index 7d1dba0d57f9..8d035d2d42a6 100644
--- a/arch/powerpc/math-emu/Makefile
+++ b/arch/powerpc/math-emu/Makefile
@@ -4,7 +4,8 @@ obj-$(CONFIG_MATH_EMULATION) += fabs.o fadd.o fadds.o fcmpo.o fcmpu.o \
4 fmadd.o fmadds.o fmsub.o fmsubs.o \ 4 fmadd.o fmadds.o fmsub.o fmsubs.o \
5 fmul.o fmuls.o fnabs.o fneg.o \ 5 fmul.o fmuls.o fnabs.o fneg.o \
6 fnmadd.o fnmadds.o fnmsub.o fnmsubs.o \ 6 fnmadd.o fnmadds.o fnmsub.o fnmsubs.o \
7 fres.o frsp.o frsqrte.o fsel.o lfs.o \ 7 fres.o fre.o frsp.o fsel.o lfs.o \
8 frsqrte.o frsqrtes.o \
8 fsqrt.o fsqrts.o fsub.o fsubs.o \ 9 fsqrt.o fsqrts.o fsub.o fsubs.o \
9 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \ 10 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \
10 mtfsf.o mtfsfi.o stfiwx.o stfs.o \ 11 mtfsf.o mtfsfi.o stfiwx.o stfs.o \
diff --git a/arch/powerpc/math-emu/fre.c b/arch/powerpc/math-emu/fre.c
new file mode 100644
index 000000000000..49ccf2cc6a5a
--- /dev/null
+++ b/arch/powerpc/math-emu/fre.c
@@ -0,0 +1,11 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int fre(void *frD, void *frB)
6{
7#ifdef DEBUG
8 printk("%s: %p %p\n", __func__, frD, frB);
9#endif
10 return -ENOSYS;
11}
diff --git a/arch/powerpc/math-emu/frsqrtes.c b/arch/powerpc/math-emu/frsqrtes.c
new file mode 100644
index 000000000000..7e838e380314
--- /dev/null
+++ b/arch/powerpc/math-emu/frsqrtes.c
@@ -0,0 +1,11 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int frsqrtes(void *frD, void *frB)
6{
7#ifdef DEBUG
8 printk("%s: %p %p\n", __func__, frD, frB);
9#endif
10 return 0;
11}
diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c
index 164d55935bd8..0328e66e0799 100644
--- a/arch/powerpc/math-emu/math.c
+++ b/arch/powerpc/math-emu/math.c
@@ -58,8 +58,10 @@ FLOATFUNC(fnabs);
58FLOATFUNC(fneg); 58FLOATFUNC(fneg);
59 59
60/* Optional */ 60/* Optional */
61FLOATFUNC(fre);
61FLOATFUNC(fres); 62FLOATFUNC(fres);
62FLOATFUNC(frsqrte); 63FLOATFUNC(frsqrte);
64FLOATFUNC(frsqrtes);
63FLOATFUNC(fsel); 65FLOATFUNC(fsel);
64FLOATFUNC(fsqrt); 66FLOATFUNC(fsqrt);
65FLOATFUNC(fsqrts); 67FLOATFUNC(fsqrts);
@@ -97,6 +99,7 @@ FLOATFUNC(fsqrts);
97#define FSQRTS 0x016 /* 22 */ 99#define FSQRTS 0x016 /* 22 */
98#define FRES 0x018 /* 24 */ 100#define FRES 0x018 /* 24 */
99#define FMULS 0x019 /* 25 */ 101#define FMULS 0x019 /* 25 */
102#define FRSQRTES 0x01a /* 26 */
100#define FMSUBS 0x01c /* 28 */ 103#define FMSUBS 0x01c /* 28 */
101#define FMADDS 0x01d /* 29 */ 104#define FMADDS 0x01d /* 29 */
102#define FNMSUBS 0x01e /* 30 */ 105#define FNMSUBS 0x01e /* 30 */
@@ -109,6 +112,7 @@ FLOATFUNC(fsqrts);
109#define FADD 0x015 /* 21 */ 112#define FADD 0x015 /* 21 */
110#define FSQRT 0x016 /* 22 */ 113#define FSQRT 0x016 /* 22 */
111#define FSEL 0x017 /* 23 */ 114#define FSEL 0x017 /* 23 */
115#define FRE 0x018 /* 24 */
112#define FMUL 0x019 /* 25 */ 116#define FMUL 0x019 /* 25 */
113#define FRSQRTE 0x01a /* 26 */ 117#define FRSQRTE 0x01a /* 26 */
114#define FMSUB 0x01c /* 28 */ 118#define FMSUB 0x01c /* 28 */
@@ -299,9 +303,10 @@ do_mathemu(struct pt_regs *regs)
299 case FDIVS: func = fdivs; type = AB; break; 303 case FDIVS: func = fdivs; type = AB; break;
300 case FSUBS: func = fsubs; type = AB; break; 304 case FSUBS: func = fsubs; type = AB; break;
301 case FADDS: func = fadds; type = AB; break; 305 case FADDS: func = fadds; type = AB; break;
302 case FSQRTS: func = fsqrts; type = AB; break; 306 case FSQRTS: func = fsqrts; type = XB; break;
303 case FRES: func = fres; type = AB; break; 307 case FRES: func = fres; type = XB; break;
304 case FMULS: func = fmuls; type = AC; break; 308 case FMULS: func = fmuls; type = AC; break;
309 case FRSQRTES: func = frsqrtes;type = XB; break;
305 case FMSUBS: func = fmsubs; type = ABC; break; 310 case FMSUBS: func = fmsubs; type = ABC; break;
306 case FMADDS: func = fmadds; type = ABC; break; 311 case FMADDS: func = fmadds; type = ABC; break;
307 case FNMSUBS: func = fnmsubs; type = ABC; break; 312 case FNMSUBS: func = fnmsubs; type = ABC; break;
@@ -317,10 +322,11 @@ do_mathemu(struct pt_regs *regs)
317 case FDIV: func = fdiv; type = AB; break; 322 case FDIV: func = fdiv; type = AB; break;
318 case FSUB: func = fsub; type = AB; break; 323 case FSUB: func = fsub; type = AB; break;
319 case FADD: func = fadd; type = AB; break; 324 case FADD: func = fadd; type = AB; break;
320 case FSQRT: func = fsqrt; type = AB; break; 325 case FSQRT: func = fsqrt; type = XB; break;
326 case FRE: func = fre; type = XB; break;
321 case FSEL: func = fsel; type = ABC; break; 327 case FSEL: func = fsel; type = ABC; break;
322 case FMUL: func = fmul; type = AC; break; 328 case FMUL: func = fmul; type = AC; break;
323 case FRSQRTE: func = frsqrte; type = AB; break; 329 case FRSQRTE: func = frsqrte; type = XB; break;
324 case FMSUB: func = fmsub; type = ABC; break; 330 case FMSUB: func = fmsub; type = ABC; break;
325 case FMADD: func = fmadd; type = ABC; break; 331 case FMADD: func = fmadd; type = ABC; break;
326 case FNMSUB: func = fnmsub; type = ABC; break; 332 case FNMSUB: func = fnmsub; type = ABC; break;