aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-11-19 17:38:25 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-10 05:39:32 -0500
commit6e7726e16fb5e8f1169dbfcb75e321ac871af827 (patch)
tree799f6f6a0041b63565b07f91b9cf95f986d97e15
parent042cf50cfd0bc3e1769d8287465eb522e8a08ba6 (diff)
[SPARC64]: Call do_mathemu on illegal instruction traps too.
To add this logic, put the VIS instruction check at the vis_emul() call site instead of inside of vis_emul(). Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc64/kernel/traps.c18
-rw-r--r--arch/sparc64/kernel/visemul.c6
2 files changed, 15 insertions, 9 deletions
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index fe1796c939c3..ec7a60142bec 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -2261,8 +2261,12 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2261 do_exit(SIGSEGV); 2261 do_exit(SIGSEGV);
2262} 2262}
2263 2263
2264#define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19))
2265#define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19))
2266
2264extern int handle_popc(u32 insn, struct pt_regs *regs); 2267extern int handle_popc(u32 insn, struct pt_regs *regs);
2265extern int handle_ldf_stq(u32 insn, struct pt_regs *regs); 2268extern int handle_ldf_stq(u32 insn, struct pt_regs *regs);
2269extern int vis_emul(struct pt_regs *, unsigned int);
2266 2270
2267void do_illegal_instruction(struct pt_regs *regs) 2271void do_illegal_instruction(struct pt_regs *regs)
2268{ 2272{
@@ -2287,10 +2291,18 @@ void do_illegal_instruction(struct pt_regs *regs)
2287 if (handle_ldf_stq(insn, regs)) 2291 if (handle_ldf_stq(insn, regs))
2288 return; 2292 return;
2289 } else if (tlb_type == hypervisor) { 2293 } else if (tlb_type == hypervisor) {
2290 extern int vis_emul(struct pt_regs *, unsigned int); 2294 if ((insn & VIS_OPCODE_MASK) == VIS_OPCODE_VAL) {
2295 if (!vis_emul(regs, insn))
2296 return;
2297 } else {
2298 struct fpustate *f = FPUSTATE;
2291 2299
2292 if (!vis_emul(regs, insn)) 2300 /* XXX maybe verify XFSR bits like
2293 return; 2301 * XXX do_fpother() does?
2302 */
2303 if (do_mathemu(regs, f))
2304 return;
2305 }
2294 } 2306 }
2295 } 2307 }
2296 info.si_signo = SIGILL; 2308 info.si_signo = SIGILL;
diff --git a/arch/sparc64/kernel/visemul.c b/arch/sparc64/kernel/visemul.c
index 84fedaa38aae..c3fd64706b53 100644
--- a/arch/sparc64/kernel/visemul.c
+++ b/arch/sparc64/kernel/visemul.c
@@ -128,9 +128,6 @@
128/* 001001100 - Permute bytes as specified by GSR.MASK */ 128/* 001001100 - Permute bytes as specified by GSR.MASK */
129#define BSHUFFLE_OPF 0x04c 129#define BSHUFFLE_OPF 0x04c
130 130
131#define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19))
132#define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19))
133
134#define VIS_OPF_SHIFT 5 131#define VIS_OPF_SHIFT 5
135#define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT) 132#define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT)
136 133
@@ -810,9 +807,6 @@ int vis_emul(struct pt_regs *regs, unsigned int insn)
810 if (get_user(insn, (u32 __user *) pc)) 807 if (get_user(insn, (u32 __user *) pc))
811 return -EFAULT; 808 return -EFAULT;
812 809
813 if ((insn & VIS_OPCODE_MASK) != VIS_OPCODE_VAL)
814 return -EINVAL;
815
816 opf = (insn & VIS_OPF_MASK) >> VIS_OPF_SHIFT; 810 opf = (insn & VIS_OPF_MASK) >> VIS_OPF_SHIFT;
817 switch (opf) { 811 switch (opf) {
818 default: 812 default: