Skip to contentSkip to conversation

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

PATCH Applied Mischa Jonker 2 participants 2 messages Sep 26, 2013 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARC: Handle zero-overhead-loop in unaligned access handler

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.

---
 arch/arc/kernel/unaligned.c |    6 ++++++
 1 file changed, 6 insertions(+)
arch/arc/kernel/unaligned.c +6 -0
index c0f832f..00ad070 100644
@@ -233,6 +233,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;
Signature · 1 line
1.7.9.5
Applied
#1 lore raw
Quoted 6 lines · Mischa Jonker

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.

Applied to for-curr for 3.12-rcX

Thx,
-Vineet

Quoted 21 lines
---
 arch/arc/kernel/unaligned.c |    6 ++++++
 1 file changed, 6 insertions(+)
arch/arc/kernel/unaligned.c +6 -0
index c0f832f..00ad070 100644
@@ -233,6 +233,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;