2 * Copyright 2015, Cyril Bur, IBM Corp.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
10 #include "basic_asm.h"
13 # Should be safe from C, only touches r4, r5 and v0,v1,v2
17 li r3,1 # assume a bad result
78 li r5,STACK_FRAME_LOCAL(0,0)
81 cmpdi r0,0xffffffffffffffff
84 1: POP_BASIC_STACK(32)
90 # r3 holds pointer to where to put the result of fork
91 # r4 holds pointer to the pid
92 # v20-v31 are non-volatile
94 std r3,STACK_FRAME_PARAM(0)(sp) # Address of varray
95 std r4,STACK_FRAME_PARAM(1)(sp) # address of pid
96 PUSH_VMX(STACK_FRAME_LOCAL(2,0),r4)
103 # Pass the result of fork back to the caller
104 ld r9,STACK_FRAME_PARAM(1)(sp)
107 ld r3,STACK_FRAME_PARAM(0)(sp)
111 POP_VMX(STACK_FRAME_LOCAL(2,0),r4)
116 # int preempt_vmx(vector int *varray, int *threads_starting, int *running)
117 # On starting will (atomically) decrement threads_starting as a signal that
118 # the VMX have been loaded with varray. Will proceed to check the validity of
119 # the VMX registers while running is not zero.
120 FUNC_START(preempt_vmx)
121 PUSH_BASIC_STACK(512)
122 std r3,STACK_FRAME_PARAM(0)(sp) # vector int *varray
123 std r4,STACK_FRAME_PARAM(1)(sp) # int *threads_starting
124 std r5,STACK_FRAME_PARAM(2)(sp) # int *running
125 # VMX need to write to 16 byte aligned addresses, skip STACK_FRAME_LOCAL(3,0)
126 PUSH_VMX(STACK_FRAME_LOCAL(4,0),r4)
133 ld r3,STACK_FRAME_PARAM(1)(sp)
139 2: ld r3,STACK_FRAME_PARAM(0)(sp)
144 ld r4,STACK_FRAME_PARAM(2)(sp)
149 3: POP_VMX(STACK_FRAME_LOCAL(4,0),r4)
152 FUNC_END(preempt_vmx)