aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/unaligned.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2005-09-28 19:48:40 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-09-28 19:48:40 -0400
commit705747ab87c96f1b4b8e73ba617c323d9087f6ac (patch)
treeefef5a442b2cccd76f94ae6cf3848519043e742d /arch/sparc64/kernel/unaligned.c
parentd2212bc7db13268bef0799d9ff4b2e511c284885 (diff)
[SPARC64]: Fix bug in unaligned load endianness swapping
The in-memory value was being swapped, not the value we loaded into the register. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/unaligned.c')
-rw-r--r--arch/sparc64/kernel/unaligned.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index 42718f6a7d36..02af08ffec8f 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -294,7 +294,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
294 294
295 kernel_mna_trap_fault(); 295 kernel_mna_trap_fault();
296 } else { 296 } else {
297 unsigned long addr; 297 unsigned long addr, *reg_addr;
298 int orig_asi, asi; 298 int orig_asi, asi;
299 299
300 addr = compute_effective_address(regs, insn, 300 addr = compute_effective_address(regs, insn,
@@ -319,11 +319,11 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
319 }; 319 };
320 switch (dir) { 320 switch (dir) {
321 case load: 321 case load:
322 do_int_load(fetch_reg_addr(((insn>>25)&0x1f), regs), 322 reg_addr = fetch_reg_addr(((insn>>25)&0x1f), regs);
323 size, (unsigned long *) addr, 323 do_int_load(reg_addr, size, (unsigned long *) addr,
324 decode_signedness(insn), asi); 324 decode_signedness(insn), asi);
325 if (unlikely(asi != orig_asi)) { 325 if (unlikely(asi != orig_asi)) {
326 unsigned long val_in = *(unsigned long *) addr; 326 unsigned long val_in = *reg_addr;
327 switch (size) { 327 switch (size) {
328 case 2: 328 case 2:
329 val_in = swab16(val_in); 329 val_in = swab16(val_in);
@@ -339,7 +339,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
339 BUG(); 339 BUG();
340 break; 340 break;
341 }; 341 };
342 *(unsigned long *) addr = val_in; 342 *reg_addr = val_in;
343 } 343 }
344 break; 344 break;
345 345