Commit 49cac7d9e62954e2235ae342ee15e0e0a7995a16

Authored by Mischa Jonker
Committed by Greg Kroah-Hartman
1 parent 186417e98f

ARC: Handle zero-overhead-loop in unaligned access handler

commit c11eb222fd7d4db91196121dbf854178505d2751 upstream.

If a load or store is the last instruction in a zero-overhead-loop, and
it's misaligned, the loop would execute only once.

This fixes that problem.

Signed-off-by: Mischa Jonker <mjonker@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

arch/arc/kernel/unaligned.c
... ... @@ -233,6 +233,12 @@
233 233 regs->status32 &= ~STATUS_DE_MASK;
234 234 } else {
235 235 regs->ret += state.instr_len;
  236 +
  237 + /* handle zero-overhead-loop */
  238 + if ((regs->ret == regs->lp_end) && (regs->lp_count)) {
  239 + regs->ret = regs->lp_start;
  240 + regs->lp_count--;
  241 + }
236 242 }
237 243  
238 244 return 0;