| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: lock_stubs.s,v 1.7 2021/07/13 01:59:10 thorpej Exp $ */ | | 1 | /* $NetBSD: lock_stubs.s,v 1.8 2021/07/13 13:58:30 thorpej Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2007, 2021 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 by Jason R. Thorpe. | | 8 | * by Andrew Doran, and by Jason R. Thorpe. |
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. |
| @@ -24,38 +24,38 @@ | | | @@ -24,38 +24,38 @@ |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
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_lockdebug.h" | | 32 | #include "opt_lockdebug.h" |
33 | #include "opt_multiprocessor.h" | | 33 | #include "opt_multiprocessor.h" |
34 | | | 34 | |
35 | #include <machine/asm.h> | | 35 | #include <machine/asm.h> |
36 | | | 36 | |
37 | __KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.7 2021/07/13 01:59:10 thorpej Exp $"); | | 37 | __KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.8 2021/07/13 13:58:30 thorpej Exp $"); |
38 | | | 38 | |
39 | #include "assym.h" | | 39 | #include "assym.h" |
40 | | | 40 | |
41 | #if defined(MULTIPROCESSOR) | | 41 | #if defined(MULTIPROCESSOR) |
42 | /* | | 42 | /* |
43 | * These 'unop' insns will be patched with 'mb' insns at run-time if | | 43 | * These 'unop' insns will be patched with 'mb' insns at run-time if |
44 | * the system has more than one processor. | | 44 | * the system has more than one processor. |
45 | */ | | 45 | */ |
46 | #define MB(label) label: unop | | 46 | #define MB(label) label: unop |
47 | #else | | 47 | #else |
48 | #define MB /* nothing */ | | 48 | #define MB(label) /* nothing */ |
49 | #endif | | 49 | #endif |
50 | | | 50 | |
51 | /* | | 51 | /* |
52 | * int _lock_cas(uintptr_t *ptr, uintptr_t old, uintptr_t new) | | 52 | * int _lock_cas(uintptr_t *ptr, uintptr_t old, uintptr_t new) |
53 | */ | | 53 | */ |
54 | LEAF(_lock_cas, 3) | | 54 | LEAF(_lock_cas, 3) |
55 | 1: | | 55 | 1: |
56 | mov a2, v0 | | 56 | mov a2, v0 |
57 | ldq_l t1, 0(a0) | | 57 | ldq_l t1, 0(a0) |
58 | cmpeq t1, a1, t1 | | 58 | cmpeq t1, a1, t1 |
59 | beq t1, 2f | | 59 | beq t1, 2f |
60 | stq_c v0, 0(a0) | | 60 | stq_c v0, 0(a0) |
61 | beq v0, 3f | | 61 | beq v0, 3f |