1 martin 1.4 ;//%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.5 ;//
|
3 martin 1.4 ;// Licensed to The Open Group (TOG) under one or more contributor license
4 ;// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 ;// this work for additional information regarding copyright ownership.
6 ;// Each contributor licenses this file to you under the OpenPegasus Open
7 ;// Source License; you may not use this file except in compliance with the
8 ;// License.
|
9 martin 1.5 ;//
|
10 martin 1.4 ;// Permission is hereby granted, free of charge, to any person obtaining a
11 ;// copy of this software and associated documentation files (the "Software"),
12 ;// to deal in the Software without restriction, including without limitation
13 ;// the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 ;// and/or sell copies of the Software, and to permit persons to whom the
15 ;// Software is furnished to do so, subject to the following conditions:
|
16 martin 1.5 ;//
|
17 martin 1.4 ;// The above copyright notice and this permission notice shall be included
18 ;// in all copies or substantial portions of the Software.
|
19 martin 1.5 ;//
|
20 martin 1.4 ;// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.5 ;// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.4 ;// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 ;// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 ;// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 ;// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 ;// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.5 ;//
|
28 martin 1.4 ;//////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.1
30 ;
31 ; LoadAndClearWord_HPUX_PARISC_ACC.s:
32 ; HP-UX PA-RISC assembly language routine for spinlock support.
33 ;
34
35 .code
36 #ifdef __LP64__
37 .level 2.0W
38 #else
39 .level 1.1
40 #endif
41 .export LoadAndClearWord,entry,priv_lev=3,rtnval=gr
42 .proc
43
44 LoadAndClearWord
45 .callinfo no_calls
46 .enter
47
48 ; create a 16 byte aligned pointer to the load+clear word area
49 addi 15,%arg0,%arg2 ; add 15 to the pointer to round up
50 kumpf 1.1
51 #ifdef __LP64__
52 depdi 0,63,4,%arg2 ; mask the lower 4 bits (64-bit)
53 #else
54 depi 0,31,4,%arg2 ; mask the lower 4 bits (32-bit)
55 #endif
56
57 #ifdef __LP64__
58 bve (%r2) ; return 0 if already locked, else !0
59 #else
60 bv (%r2) ; return 0 if already locked, else !0
61 #endif
62 ldcws,co (%arg2),%ret0 ; (in branch delay slot)
63 ; load and clear (coherent) the spinlock word
64
65 ; This code is never executed. This endless loop reduces the
66 ; prefetching after mispredicted bv on pre PA 8700 processors.
67 ; Leave this dead code here to improve performance.
68
69 load_and_clear_loop
70 b load_and_clear_loop
71 kumpf 1.1 nop
72 .leave
73 .procend
|