1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 2 /* 3 * Copyright 2015, Cyril Bur, IBM Corp. 3 * Copyright 2015, Cyril Bur, IBM Corp. 4 */ 4 */ 5 5 6 #include "basic_asm.h" 6 #include "basic_asm.h" 7 #include "vsx_asm.h" 7 #include "vsx_asm.h" 8 8 9 #long check_vsx(vector int *r3); 9 #long check_vsx(vector int *r3); 10 #This function wraps storeing VSX regs to the 10 #This function wraps storeing VSX regs to the end of an array and a 11 #call to a comparison function in C which boil 11 #call to a comparison function in C which boils down to a memcmp() 12 FUNC_START(check_vsx) 12 FUNC_START(check_vsx) 13 PUSH_BASIC_STACK(32) 13 PUSH_BASIC_STACK(32) 14 std r3,STACK_FRAME_PARAM(0)(sp) 14 std r3,STACK_FRAME_PARAM(0)(sp) 15 addi r3, r3, 16 * 12 #Second half of a 15 addi r3, r3, 16 * 12 #Second half of array 16 bl store_vsx 16 bl store_vsx 17 ld r3,STACK_FRAME_PARAM(0)(sp) 17 ld r3,STACK_FRAME_PARAM(0)(sp) 18 bl vsx_memcmp 18 bl vsx_memcmp 19 POP_BASIC_STACK(32) 19 POP_BASIC_STACK(32) 20 blr 20 blr 21 FUNC_END(check_vsx) 21 FUNC_END(check_vsx) 22 22 23 # int preempt_vmx(vector int *varray, int *thr 23 # int preempt_vmx(vector int *varray, int *threads_starting, 24 # int *running); 24 # int *running); 25 # On starting will (atomically) decrement thre 25 # On starting will (atomically) decrement threads_starting as a signal 26 # that the VMX have been loaded with varray. W 26 # that the VMX have been loaded with varray. Will proceed to check the 27 # validity of the VMX registers while running 27 # validity of the VMX registers while running is not zero. 28 FUNC_START(preempt_vsx) 28 FUNC_START(preempt_vsx) 29 PUSH_BASIC_STACK(512) 29 PUSH_BASIC_STACK(512) 30 std r3,STACK_FRAME_PARAM(0)(sp) # vect 30 std r3,STACK_FRAME_PARAM(0)(sp) # vector int *varray 31 std r4,STACK_FRAME_PARAM(1)(sp) # int 31 std r4,STACK_FRAME_PARAM(1)(sp) # int *threads_starting 32 std r5,STACK_FRAME_PARAM(2)(sp) # int 32 std r5,STACK_FRAME_PARAM(2)(sp) # int *running 33 33 34 bl load_vsx 34 bl load_vsx 35 nop 35 nop 36 36 37 sync 37 sync 38 # Atomic DEC 38 # Atomic DEC 39 ld r3,STACK_FRAME_PARAM(1)(sp) 39 ld r3,STACK_FRAME_PARAM(1)(sp) 40 1: lwarx r4,0,r3 40 1: lwarx r4,0,r3 41 addi r4,r4,-1 41 addi r4,r4,-1 42 stwcx. r4,0,r3 42 stwcx. r4,0,r3 43 bne- 1b 43 bne- 1b 44 44 45 2: ld r3,STACK_FRAME_PARAM(0)(sp) 45 2: ld r3,STACK_FRAME_PARAM(0)(sp) 46 bl check_vsx 46 bl check_vsx 47 nop 47 nop 48 cmpdi r3,0 48 cmpdi r3,0 49 bne 3f 49 bne 3f 50 ld r4,STACK_FRAME_PARAM(2)(sp) 50 ld r4,STACK_FRAME_PARAM(2)(sp) 51 ld r5,0(r4) 51 ld r5,0(r4) 52 cmpwi r5,0 52 cmpwi r5,0 53 bne 2b 53 bne 2b 54 54 55 3: POP_BASIC_STACK(512) 55 3: POP_BASIC_STACK(512) 56 blr 56 blr 57 FUNC_END(preempt_vsx) 57 FUNC_END(preempt_vsx)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.