aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/unaligned.c
diff options
context:
space:
mode:
authorLeonid Yegoshin <Leonid.Yegoshin@imgtec.com>2013-03-25 13:09:02 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-05-09 11:55:18 -0400
commit102cedc32a6e3cd537374a3678d407591d5a6fab (patch)
tree7a91493a82e65c0da845afb12020e1534d83ee5d /arch/mips/kernel/unaligned.c
parentcf6d905828c2c75ebe8c818901e71e09ffe6f629 (diff)
MIPS: microMIPS: Floating point support.
Add logic needed to do floating point emulation in microMIPS mode. Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com> Signed-off-by: Steven J. Hill <Steven. Hill@imgtec.com>
Diffstat (limited to 'arch/mips/kernel/unaligned.c')
-rw-r--r--arch/mips/kernel/unaligned.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 6087a54c86a0..f4c94ff3e3d3 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -83,6 +83,8 @@
83#include <asm/branch.h> 83#include <asm/branch.h>
84#include <asm/byteorder.h> 84#include <asm/byteorder.h>
85#include <asm/cop2.h> 85#include <asm/cop2.h>
86#include <asm/fpu.h>
87#include <asm/fpu_emulator.h>
86#include <asm/inst.h> 88#include <asm/inst.h>
87#include <asm/uaccess.h> 89#include <asm/uaccess.h>
88 90
@@ -108,6 +110,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
108 union mips_instruction insn; 110 union mips_instruction insn;
109 unsigned long value; 111 unsigned long value;
110 unsigned int res; 112 unsigned int res;
113 void __user *fault_addr = NULL;
111 114
112 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, 0); 115 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, 0);
113 116
@@ -447,10 +450,21 @@ static void emulate_load_store_insn(struct pt_regs *regs,
447 case ldc1_op: 450 case ldc1_op:
448 case swc1_op: 451 case swc1_op:
449 case sdc1_op: 452 case sdc1_op:
450 /* 453 die_if_kernel("Unaligned FP access in kernel code", regs);
451 * I herewith declare: this does not happen. So send SIGBUS. 454 BUG_ON(!used_math());
452 */ 455 BUG_ON(!is_fpu_owner());
453 goto sigbus; 456
457 lose_fpu(1); /* Save FPU state for the emulator. */
458 res = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1,
459 &fault_addr);
460 own_fpu(1); /* Restore FPU state. */
461
462 /* Signal if something went wrong. */
463 process_fpemu_return(res, fault_addr);
464
465 if (res == 0)
466 break;
467 return;
454 468
455 /* 469 /*
456 * COP2 is available to implementor for application specific use. 470 * COP2 is available to implementor for application specific use.