1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/pr/src/md/unix/os_Irix.s Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,134 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 + * Atomically add a new element to the top of the stack 1.11 + * 1.12 + * usage : PR_StackPush(listp, elementp); 1.13 + * ----------------------- 1.14 + */ 1.15 + 1.16 +#include "md/_irix.h" 1.17 +#ifdef _PR_HAVE_ATOMIC_CAS 1.18 + 1.19 +#include <sys/asm.h> 1.20 +#include <sys/regdef.h> 1.21 + 1.22 +LEAF(PR_StackPush) 1.23 + 1.24 +retry_push: 1.25 +.set noreorder 1.26 + lw v0,0(a0) 1.27 + li t1,1 1.28 + beq v0,t1,retry_push 1.29 + move t0,a1 1.30 + 1.31 + ll v0,0(a0) 1.32 + beq v0,t1,retry_push 1.33 + nop 1.34 + sc t1,0(a0) 1.35 + beq t1,0,retry_push 1.36 + nop 1.37 + sw v0,0(a1) 1.38 + sync 1.39 + sw t0,0(a0) 1.40 + nop 1.41 + nop 1.42 + nop 1.43 + nop 1.44 + nop 1.45 + nop 1.46 + nop 1.47 + nop 1.48 + nop 1.49 + nop 1.50 + nop 1.51 + nop 1.52 + nop 1.53 + nop 1.54 + nop 1.55 + nop 1.56 + nop 1.57 + nop 1.58 + nop 1.59 + nop 1.60 + nop 1.61 + nop 1.62 + nop 1.63 + nop 1.64 + nop 1.65 + nop 1.66 + nop 1.67 + nop 1.68 + jr ra 1.69 + nop 1.70 + 1.71 +END(PR_StackPush) 1.72 + 1.73 +/* 1.74 + * 1.75 + * Atomically remove the element at the top of the stack 1.76 + * 1.77 + * usage : elemep = PR_StackPop(listp); 1.78 + * 1.79 + */ 1.80 + 1.81 +LEAF(PR_StackPop) 1.82 +retry_pop: 1.83 +.set noreorder 1.84 + 1.85 + 1.86 + lw v0,0(a0) 1.87 + li t1,1 1.88 + beq v0,0,done 1.89 + nop 1.90 + beq v0,t1,retry_pop 1.91 + nop 1.92 + 1.93 + ll v0,0(a0) 1.94 + beq v0,0,done 1.95 + nop 1.96 + beq v0,t1,retry_pop 1.97 + nop 1.98 + sc t1,0(a0) 1.99 + beq t1,0,retry_pop 1.100 + nop 1.101 + lw t0,0(v0) 1.102 + sw t0,0(a0) 1.103 +done: 1.104 + nop 1.105 + nop 1.106 + nop 1.107 + nop 1.108 + nop 1.109 + nop 1.110 + nop 1.111 + nop 1.112 + nop 1.113 + nop 1.114 + nop 1.115 + nop 1.116 + nop 1.117 + nop 1.118 + nop 1.119 + nop 1.120 + nop 1.121 + nop 1.122 + nop 1.123 + nop 1.124 + nop 1.125 + nop 1.126 + nop 1.127 + nop 1.128 + nop 1.129 + nop 1.130 + nop 1.131 + nop 1.132 + jr ra 1.133 + nop 1.134 + 1.135 +END(PR_StackPop) 1.136 + 1.137 +#endif /* _PR_HAVE_ATOMIC_CAS */