summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib/feature-fixups-test.S
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2018-04-16 16:39:05 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2018-05-11 15:29:03 +0200
commit6158faed7c80256fb6b370781cb3cd6815f4ba69 (patch)
tree4ac69bbbda49b8975863df88893a370c0a7b8e0c /arch/powerpc/lib/feature-fixups-test.S
parentpowerpc/lib: Rename ftr_fixup_test7 to ftr_fixup_test_too_big (diff)
downloadlinux-6158faed7c80256fb6b370781cb3cd6815f4ba69.tar.xz
linux-6158faed7c80256fb6b370781cb3cd6815f4ba69.zip
powerpc/lib: Add alt patching test of branching past the last instruction
Add a test of the relative branch patching logic in the alternate section feature fixup code. This tests that if we branch past the last instruction of the alternate section, the branch is not patched. That's because the assembler will have created a branch that already points to the first instruction after the patched section, which is correct and needs no further patching. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/lib/feature-fixups-test.S')
-rw-r--r--arch/powerpc/lib/feature-fixups-test.S36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/powerpc/lib/feature-fixups-test.S b/arch/powerpc/lib/feature-fixups-test.S
index dd05afcbcde3..f16cec989506 100644
--- a/arch/powerpc/lib/feature-fixups-test.S
+++ b/arch/powerpc/lib/feature-fixups-test.S
@@ -171,6 +171,42 @@ globl(ftr_fixup_test6_expected)
or 2,2,2
or 3,3,3
+globl(ftr_fixup_test7)
+ or 1,1,1
+BEGIN_FTR_SECTION
+ or 2,2,2
+ or 2,2,2
+ or 2,2,2
+ or 2,2,2
+ or 2,2,2
+ or 2,2,2
+ or 2,2,2
+FTR_SECTION_ELSE
+2: b 3f
+3: or 5,5,5
+ beq 3b
+ b 1f
+ or 6,6,6
+ b 2b
+ bdnz 3b
+1:
+ALT_FTR_SECTION_END(0, 1)
+ or 1,1,1
+ or 1,1,1
+
+globl(end_ftr_fixup_test7)
+ nop
+
+globl(ftr_fixup_test7_expected)
+ or 1,1,1
+2: b 3f
+3: or 5,5,5
+ beq 3b
+ b 1f
+ or 6,6,6
+ b 2b
+ bdnz 3b
+1: or 1,1,1
#if 0
/* Test that if we have a larger else case the assembler spots it and