aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2008-12-03 22:36:05 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-03 22:36:05 -0500
commit726c12f57d7e3ff43693d88e13b1ff02464c75d3 (patch)
tree66e85c2c65fa99e3b256cb77678109916d91bfa9
parente8e8e80ee047b131a0cd6a3e96e0f8dfa14f6d99 (diff)
sparc64: Fix VIS emulation bugs
This patch fixes some bugs in VIS emulation that cause the GCC test failure FAIL: gcc.target/sparc/pdist-3.c execution test for both 32-bit and 64-bit testing on hardware lacking these instructions. The emulation code for the pdist instruction uses RS1(insn) for both source registers rs1 and rs2, which is obviously wrong and leads to the instruction doing nothing (the observed problem), and further inspection of the code shows that RS1 uses a shift of 24 and RD a shift of 25, which clearly cannot both be right; examining SPARC documentation indicates the correct shift for RS1 is 14. This patch fixes the bug if single-stepping over the affected instruction in the debugger, but not if the testcase is run standalone. For that, Wind River has another patch I hope they will send as a followup to this patch submission. Signed-off-by: Joseph Myers <joseph@codesourcery.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc64/kernel/visemul.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/sparc64/kernel/visemul.c b/arch/sparc64/kernel/visemul.c
index 9e05cb5cb855..69f8a35c6bcd 100644
--- a/arch/sparc64/kernel/visemul.c
+++ b/arch/sparc64/kernel/visemul.c
@@ -131,7 +131,7 @@
131#define VIS_OPF_SHIFT 5 131#define VIS_OPF_SHIFT 5
132#define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT) 132#define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT)
133 133
134#define RS1(INSN) (((INSN) >> 24) & 0x1f) 134#define RS1(INSN) (((INSN) >> 14) & 0x1f)
135#define RS2(INSN) (((INSN) >> 0) & 0x1f) 135#define RS2(INSN) (((INSN) >> 0) & 0x1f)
136#define RD(INSN) (((INSN) >> 25) & 0x1f) 136#define RD(INSN) (((INSN) >> 25) & 0x1f)
137 137
@@ -445,7 +445,7 @@ static void pdist(struct pt_regs *regs, unsigned int insn)
445 unsigned long i; 445 unsigned long i;
446 446
447 rs1 = fpd_regval(f, RS1(insn)); 447 rs1 = fpd_regval(f, RS1(insn));
448 rs2 = fpd_regval(f, RS1(insn)); 448 rs2 = fpd_regval(f, RS2(insn));
449 rd = fpd_regaddr(f, RD(insn)); 449 rd = fpd_regaddr(f, RD(insn));
450 450
451 rd_val = *rd; 451 rd_val = *rd;