Commit 705747ab authored by David S. Miller's avatar David S. Miller

[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: default avatarDavid S. Miller <davem@davemloft.net>
parent d2212bc7
...@@ -294,7 +294,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u ...@@ -294,7 +294,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
kernel_mna_trap_fault(); kernel_mna_trap_fault();
} else { } else {
unsigned long addr; unsigned long addr, *reg_addr;
int orig_asi, asi; int orig_asi, asi;
addr = compute_effective_address(regs, insn, addr = compute_effective_address(regs, insn,
...@@ -319,11 +319,11 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u ...@@ -319,11 +319,11 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
}; };
switch (dir) { switch (dir) {
case load: case load:
do_int_load(fetch_reg_addr(((insn>>25)&0x1f), regs), reg_addr = fetch_reg_addr(((insn>>25)&0x1f), regs);
size, (unsigned long *) addr, do_int_load(reg_addr, size, (unsigned long *) addr,
decode_signedness(insn), asi); decode_signedness(insn), asi);
if (unlikely(asi != orig_asi)) { if (unlikely(asi != orig_asi)) {
unsigned long val_in = *(unsigned long *) addr; unsigned long val_in = *reg_addr;
switch (size) { switch (size) {
case 2: case 2:
val_in = swab16(val_in); val_in = swab16(val_in);
...@@ -339,7 +339,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u ...@@ -339,7 +339,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
BUG(); BUG();
break; break;
}; };
*(unsigned long *) addr = val_in; *reg_addr = val_in;
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment