58 lines · plain
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 * Copyright 2015, Cyril Bur, IBM Corp.4 */5 6#include "basic_asm.h"7#include "vsx_asm.h"8 9#long check_vsx(vector int *r3);10#This function wraps storeing VSX regs to the end of an array and a11#call to a comparison function in C which boils down to a memcmp()12FUNC_START(check_vsx)13 PUSH_BASIC_STACK(32)14 std r3,STACK_FRAME_PARAM(0)(sp)15 addi r3, r3, 16 * 12 #Second half of array16 bl store_vsx17 ld r3,STACK_FRAME_PARAM(0)(sp)18 bl vsx_memcmp19 POP_BASIC_STACK(32)20 blr21FUNC_END(check_vsx)22 23# int preempt_vmx(vector int *varray, int *threads_starting,24# int *running);25# On starting will (atomically) decrement threads_starting as a signal26# that the VMX have been loaded with varray. Will proceed to check the27# validity of the VMX registers while running is not zero.28FUNC_START(preempt_vsx)29 PUSH_BASIC_STACK(512)30 std r3,STACK_FRAME_PARAM(0)(sp) # vector int *varray31 std r4,STACK_FRAME_PARAM(1)(sp) # int *threads_starting32 std r5,STACK_FRAME_PARAM(2)(sp) # int *running33 34 bl load_vsx35 nop36 37 sync38 # Atomic DEC39 ld r3,STACK_FRAME_PARAM(1)(sp)401: lwarx r4,0,r341 addi r4,r4,-142 stwcx. r4,0,r343 bne- 1b44 452: ld r3,STACK_FRAME_PARAM(0)(sp)46 bl check_vsx47 nop48 cmpdi r3,049 bne 3f50 ld r4,STACK_FRAME_PARAM(2)(sp)51 ld r5,0(r4)52 cmpwi r5,053 bne 2b54 553: POP_BASIC_STACK(512)56 blr57FUNC_END(preempt_vsx)58