]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARC: Handle zero-overhead-loop in unaligned access handler
authorMischa Jonker <mjonker@synopsys.com>
Thu, 26 Sep 2013 13:44:56 +0000 (15:44 +0200)
committerVineet Gupta <vgupta@synopsys.com>
Fri, 27 Sep 2013 10:58:23 +0000 (16:28 +0530)
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>
arch/arc/kernel/unaligned.c

index 28d1700607474eb01be14e0600832bf7ee4cf999..7ff5b5c183bb026716295c13f7b123de1d67a96f 100644 (file)
@@ -245,6 +245,12 @@ int misaligned_fixup(unsigned long address, struct pt_regs *regs,
                regs->status32 &= ~STATUS_DE_MASK;
        } else {
                regs->ret += state.instr_len;
+
+               /* handle zero-overhead-loop */
+               if ((regs->ret == regs->lp_end) && (regs->lp_count)) {
+                       regs->ret = regs->lp_start;
+                       regs->lp_count--;
+               }
        }
 
        return 0;