aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/math/fpu_asm.S
diff options
context:
space:
mode:
authorCyril Bur <cyrilbur@gmail.com>2016-02-29 17:53:44 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2016-03-02 23:34:47 +1100
commite5ab8be68e4421d7f8d4e69e2a8ddb3d69508d2a (patch)
tree5a938174a6c5062aded2cb0015563b63f9c2f532 /tools/testing/selftests/powerpc/math/fpu_asm.S
parentselftests/powerpc: Test the preservation of FPU and VMX regs across syscall (diff)
downloadlinux-dev-e5ab8be68e4421d7f8d4e69e2a8ddb3d69508d2a.tar.xz
linux-dev-e5ab8be68e4421d7f8d4e69e2a8ddb3d69508d2a.zip
selftests/powerpc: Test preservation of FPU and VMX regs across preemption
Loop in assembly checking the registers with many threads. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'tools/testing/selftests/powerpc/math/fpu_asm.S')
-rw-r--r--tools/testing/selftests/powerpc/math/fpu_asm.S37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/math/fpu_asm.S b/tools/testing/selftests/powerpc/math/fpu_asm.S
index 7617da3117ba..f3711d80e709 100644
--- a/tools/testing/selftests/powerpc/math/fpu_asm.S
+++ b/tools/testing/selftests/powerpc/math/fpu_asm.S
@@ -159,3 +159,40 @@ FUNC_START(test_fpu)
POP_BASIC_STACK(256)
blr
FUNC_END(test_fpu)
+
+# int preempt_fpu(double *darray, int *threads_running, int *running)
+# On starting will (atomically) decrement not_ready as a signal that the FPU
+# has been loaded with darray. Will proceed to check the validity of the FPU
+# registers while running is not zero.
+FUNC_START(preempt_fpu)
+ PUSH_BASIC_STACK(256)
+ std r3,STACK_FRAME_PARAM(0)(sp) # double *darray
+ std r4,STACK_FRAME_PARAM(1)(sp) # int *threads_starting
+ std r5,STACK_FRAME_PARAM(2)(sp) # int *running
+ PUSH_FPU(STACK_FRAME_LOCAL(3,0))
+
+ bl load_fpu
+ nop
+
+ sync
+ # Atomic DEC
+ ld r3,STACK_FRAME_PARAM(1)(sp)
+1: lwarx r4,0,r3
+ addi r4,r4,-1
+ stwcx. r4,0,r3
+ bne- 1b
+
+2: ld r3,STACK_FRAME_PARAM(0)(sp)
+ bl check_fpu
+ nop
+ cmpdi r3,0
+ bne 3f
+ ld r4,STACK_FRAME_PARAM(2)(sp)
+ ld r5,0(r4)
+ cmpwi r5,0
+ bne 2b
+
+3: POP_FPU(STACK_FRAME_LOCAL(3,0))
+ POP_BASIC_STACK(256)
+ blr
+FUNC_END(preempt_fpu)