Tue Apr 3 14:18:14 2012 UTC ()
Use GET_CURLWP


(skrll)
diff -r1.25 -r1.26 src/sys/arch/hppa/hppa/lock_stubs.S

cvs diff -r1.25 -r1.26 src/sys/arch/hppa/hppa/lock_stubs.S (expand / switch to unified diff)

--- src/sys/arch/hppa/hppa/lock_stubs.S 2012/04/03 14:15:47 1.25
+++ src/sys/arch/hppa/hppa/lock_stubs.S 2012/04/03 14:18:14 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lock_stubs.S,v 1.25 2012/04/03 14:15:47 skrll Exp $ */ 1/* $NetBSD: lock_stubs.S,v 1.26 2012/04/03 14:18:14 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran and Nick Hudson. 8 * by Andrew Doran and Nick Hudson.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,26 +27,27 @@ @@ -27,26 +27,27 @@
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include "opt_multiprocessor.h" 32#include "opt_multiprocessor.h"
33#include "opt_lockdebug.h" 33#include "opt_lockdebug.h"
34 34
35#define __MUTEX_PRIVATE 35#define __MUTEX_PRIVATE
36 36
37#include <machine/asm.h> 37#include <machine/asm.h>
38#include <machine/mutex.h> 38#include <machine/mutex.h>
39#include <machine/reg.h> 39#include <machine/reg.h>
 40#include <machine/cpu.h>
40 41
41#include "assym.h" 42#include "assym.h"
42 43
43/* 44/*
44 * uintptr_t _lock_cas(volatile uintptr_t *ptr, uintptr_t old, uintptr_t new); 45 * uintptr_t _lock_cas(volatile uintptr_t *ptr, uintptr_t old, uintptr_t new);
45 * 46 *
46 * Perform an atomic compare-and-swap operation. 47 * Perform an atomic compare-and-swap operation.
47 * 48 *
48 * On single CPU systems this can use a restartable sequence as there 49 * On single CPU systems this can use a restartable sequence as there
49 * we don't need the overhead of interlocking. 50 * we don't need the overhead of interlocking.
50 */ 51 */
51 52
52 53
@@ -141,27 +142,27 @@ LEAF_ENTRY(mutex_enter) @@ -141,27 +142,27 @@ LEAF_ENTRY(mutex_enter)
141 * 142 *
142 * Even if we are preempted between acquiring the lock and 143 * Even if we are preempted between acquiring the lock and
143 * setting the owners field, there is no problem - noone 144 * setting the owners field, there is no problem - noone
144 * else can acquire the mutex while the lock is held. 145 * else can acquire the mutex while the lock is held.
145 */ 146 */
146.Lmutexunowned: 147.Lmutexunowned:
147 ldo (MTX_LOCK + HPPA_LDCW_ALIGN - 1)(%arg0), %t1 148 ldo (MTX_LOCK + HPPA_LDCW_ALIGN - 1)(%arg0), %t1
148 depi 0, 31, 4, %t1 149 depi 0, 31, 4, %t1
149 ldcw 0(%t1), %ret0 150 ldcw 0(%t1), %ret0
150 151
151mutex_enter_crit_start: 152mutex_enter_crit_start:
152 comib,= 0, %ret0, .Lenter_slowpath 153 comib,= 0, %ret0, .Lenter_slowpath
153 154
154 mfctl CR_CURLWP, %t2 155 GET_CURLWP(%t2)
155 156
156 bv %r0(%rp) 157 bv %r0(%rp)
157mutex_enter_crit_end: 158mutex_enter_crit_end:
158 stw %t2, MTX_OWNER(%arg0) 159 stw %t2, MTX_OWNER(%arg0)
159EXIT(mutex_enter) 160EXIT(mutex_enter)
160 161
161#endif /* !LOCKDEBUG */ 162#endif /* !LOCKDEBUG */
162 163
163#ifndef MULTIPROCESSOR 164#ifndef MULTIPROCESSOR
164 165
165 .global _lock_cas_ras_start 166 .global _lock_cas_ras_start
166 .global _lock_cas_ras_end 167 .global _lock_cas_ras_end
167 168