1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright 2015, Cyril Bur, IBM Corp.
9 # Should be safe from C, only touches r4, r5 and v0,v1,v2
13 li r3,1 # assume a bad result
74 li r5,STACK_FRAME_LOCAL(0,0)
77 cmpdi r0,0xffffffffffffffff
80 1: POP_BASIC_STACK(32)
86 # r3 holds pointer to where to put the result of fork
87 # r4 holds pointer to the pid
88 # v20-v31 are non-volatile
90 std r3,STACK_FRAME_PARAM(0)(sp) # Address of varray
91 std r4,STACK_FRAME_PARAM(1)(sp) # address of pid
92 PUSH_VMX(STACK_FRAME_LOCAL(2,0),r4)
99 # Pass the result of fork back to the caller
100 ld r9,STACK_FRAME_PARAM(1)(sp)
103 ld r3,STACK_FRAME_PARAM(0)(sp)
107 POP_VMX(STACK_FRAME_LOCAL(2,0),r4)
112 # int preempt_vmx(vector int *varray, int *threads_starting, int *running)
113 # On starting will (atomically) decrement threads_starting as a signal that
114 # the VMX have been loaded with varray. Will proceed to check the validity of
115 # the VMX registers while running is not zero.
116 FUNC_START(preempt_vmx)
117 PUSH_BASIC_STACK(512)
118 std r3,STACK_FRAME_PARAM(0)(sp) # vector int *varray
119 std r4,STACK_FRAME_PARAM(1)(sp) # int *threads_starting
120 std r5,STACK_FRAME_PARAM(2)(sp) # int *running
121 # VMX need to write to 16 byte aligned addresses, skip STACK_FRAME_LOCAL(3,0)
122 PUSH_VMX(STACK_FRAME_LOCAL(4,0),r4)
129 ld r3,STACK_FRAME_PARAM(1)(sp)
135 2: ld r3,STACK_FRAME_PARAM(0)(sp)
140 ld r4,STACK_FRAME_PARAM(2)(sp)
145 3: POP_VMX(STACK_FRAME_LOCAL(4,0),r4)
148 FUNC_END(preempt_vmx)