1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright 2015, Cyril Bur, IBM Corp.
11 li r3,1 # assume a bad result
70 // int check_all_fprs(double darray[32])
71 FUNC_START(check_all_fprs)
73 mr r4, r3 // r4 = darray
74 li r3, 1 // prepare for failure
76 stfd f31, STACK_FRAME_LOCAL(0, 0)(sp) // backup f31
78 // Check regs f0-f30, using f31 as scratch
81 lfd f31, (8 * i)(r4) // load expected value
82 fcmpu cr0, i, f31 // compare
83 bne cr0, 1f // bail if mismatch
87 lfd f31, STACK_FRAME_LOCAL(0, 0)(sp) // reload f31
88 stfd f30, STACK_FRAME_LOCAL(0, 0)(sp) // backup f30
90 lfd f30, (8 * 31)(r4) // load expected value of f31
91 fcmpu cr0, f30, f31 // compare
92 bne cr0, 1f // bail if mismatch
94 lfd f30, STACK_FRAME_LOCAL(0, 0)(sp) // reload f30
101 FUNC_END(check_all_fprs)
104 # r3 holds pointer to where to put the result of fork
105 # r4 holds pointer to the pid
106 # f14-f31 are non volatiles
107 PUSH_BASIC_STACK(256)
109 std r3,STACK_FRAME_PARAM(0)(sp) # Address of darray
110 std r4,STACK_FRAME_PARAM(1)(sp) # Address of pid
112 // Load FPRs with expected values
113 OP_REGS lfd, 8, 0, 31, r3
118 # pass the result of the fork to the caller
119 ld r9,STACK_FRAME_PARAM(1)(sp)
122 ld r3,STACK_FRAME_PARAM(0)(sp)
131 # int preempt_fpu(double *darray, int *threads_running, int *running)
132 # On starting will (atomically) decrement not_ready as a signal that the FPU
133 # has been loaded with darray. Will proceed to check the validity of the FPU
134 # registers while running is not zero.
135 FUNC_START(preempt_fpu)
136 PUSH_BASIC_STACK(256)
138 std r3,STACK_FRAME_PARAM(0)(sp) # double *darray
139 std r4,STACK_FRAME_PARAM(1)(sp) # int *threads_starting
140 std r5,STACK_FRAME_PARAM(2)(sp) # int *running
142 // Load FPRs with expected values
143 OP_REGS lfd, 8, 0, 31, r3
147 ld r3,STACK_FRAME_PARAM(1)(sp)
153 2: ld r3,STACK_FRAME_PARAM(0)(sp)
157 ld r4,STACK_FRAME_PARAM(2)(sp)
165 FUNC_END(preempt_fpu)