Thu Feb 20 20:39:01 2014 UTC ()
Add missing __sync_* ops
(martin)
diff -r1.11 -r1.12 src/common/lib/libc/arch/m68k/atomic/Makefile.inc
diff -r1.7 -r1.8 src/common/lib/libc/arch/m68k/atomic/atomic_add.S
diff -r1.8 -r1.9 src/common/lib/libc/arch/m68k/atomic/atomic_and.S
diff -r1.8 -r1.9 src/common/lib/libc/arch/m68k/atomic/atomic_or.S
diff -r0 -r1.1 src/common/lib/libc/arch/m68k/atomic/atomic_nand.S
diff -r0 -r1.1 src/common/lib/libc/arch/m68k/atomic/atomic_sub.S
diff -r0 -r1.1 src/common/lib/libc/arch/m68k/atomic/atomic_xor.S
--- src/common/lib/libc/arch/m68k/atomic/Makefile.inc 2014/01/29 10:20:11 1.11
+++ src/common/lib/libc/arch/m68k/atomic/Makefile.inc 2014/02/20 20:39:01 1.12
| @@ -1,30 +1,31 @@ | | | @@ -1,30 +1,31 @@ |
1 | # $NetBSD: Makefile.inc,v 1.11 2014/01/29 10:20:11 martin Exp $ | | 1 | # $NetBSD: Makefile.inc,v 1.12 2014/02/20 20:39:01 martin Exp $ |
2 | | | 2 | |
3 | # | | 3 | # |
4 | # Note: The atomic operations here in these assembly files are atomic | | 4 | # Note: The atomic operations here in these assembly files are atomic |
5 | # only with respect to regular memory on uniprocessor systems. Since | | 5 | # only with respect to regular memory on uniprocessor systems. Since |
6 | # we don't support any MP m68k systems, this is just fine. If we ever | | 6 | # we don't support any MP m68k systems, this is just fine. If we ever |
7 | # do, then these routines will probably need to be replaced with CAS- | | 7 | # do, then these routines will probably need to be replaced with CAS- |
8 | # based routines (CAS generates an atomic bus cycle, whereas these | | 8 | # based routines (CAS generates an atomic bus cycle, whereas these |
9 | # others are merely single-instruction). | | 9 | # others are merely single-instruction). |
10 | # | | 10 | # |
11 | | | 11 | |
12 | .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ | | 12 | .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ |
13 | || ${LIB} == "rump") | | 13 | || ${LIB} == "rump") |
14 | .if ${MACHINE_ARCH} == "m68k" | | 14 | .if ${MACHINE_ARCH} == "m68k" |
15 | | | 15 | |
16 | SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ | | 16 | SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ |
17 | atomic_inc.S atomic_or.S atomic_swap.S membar_ops_nop.c | | 17 | atomic_inc.S atomic_or.S atomic_swap.S membar_ops_nop.c \ |
| | | 18 | atomic_sub.S atomic_xor.S atomic_nand.S |
18 | | | 19 | |
19 | .else | | 20 | .else |
20 | | | 21 | |
21 | SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ | | 22 | SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ |
22 | atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ | | 23 | atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ |
23 | atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ | | 24 | atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ |
24 | atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c | | 25 | atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c |
25 | | | 26 | |
26 | .endif | | 27 | .endif |
27 | .endif | | 28 | .endif |
28 | | | 29 | |
29 | .if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") | | 30 | .if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") |
30 | .if ${MACHINE_ARCH} == "m68k" | | 31 | .if ${MACHINE_ARCH} == "m68k" |
--- src/common/lib/libc/arch/m68k/atomic/atomic_add.S 2014/02/18 16:19:28 1.7
+++ src/common/lib/libc/arch/m68k/atomic/atomic_add.S 2014/02/20 20:39:01 1.8
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: atomic_add.S,v 1.7 2014/02/18 16:19:28 martin Exp $ */ | | 1 | /* $NetBSD: atomic_add.S,v 1.8 2014/02/20 20:39:01 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 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 Jason R. Thorpe. | | 8 | * 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. |
| @@ -58,36 +58,67 @@ ENTRY(_atomic_add_32_nv) | | | @@ -58,36 +58,67 @@ ENTRY(_atomic_add_32_nv) |
58 | movl %d0, %a0 /* pointers return also in %a0 */ | | 58 | movl %d0, %a0 /* pointers return also in %a0 */ |
59 | rts | | 59 | rts |
60 | END(_atomic_add_32_nv) | | 60 | END(_atomic_add_32_nv) |
61 | | | 61 | |
62 | ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) | | 62 | ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) |
63 | ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) | | 63 | ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) |
64 | STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) | | 64 | STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) |
65 | ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv) | | 65 | ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv) |
66 | STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) | | 66 | STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) |
67 | ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) | | 67 | ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) |
68 | STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) | | 68 | STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) |
69 | STRONG_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv) | | 69 | STRONG_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv) |
70 | | | 70 | |
| | | 71 | ENTRY(__sync_fetch_and_add_4) |
| | | 72 | movl 4(%sp), %a0 |
| | | 73 | 1: movl (%a0), %d0 |
| | | 74 | movl %d0, %d1 |
| | | 75 | addl 8(%sp), %d1 |
| | | 76 | casl %d0, %d1, (%a0) |
| | | 77 | bne 1b |
| | | 78 | movl %d0, %a0 /* pointers return also in %a0 */ |
| | | 79 | rts |
| | | 80 | END(__sync_fetch_and_add_4) |
| | | 81 | |
71 | ENTRY(_atomic_add_16_nv) | | 82 | ENTRY(_atomic_add_16_nv) |
72 | movl 4(%sp), %a0 | | 83 | movl 4(%sp), %a0 |
73 | 1: movw (%a0), %d0 | | 84 | 1: movw (%a0), %d0 |
74 | movw %d0, %d1 | | 85 | movw %d0, %d1 |
75 | addw 8(%sp), %d0 | | 86 | addw 8(%sp), %d0 |
76 | casw %d1, %d0, (%a0) | | 87 | casw %d1, %d0, (%a0) |
77 | bne 1b | | 88 | bne 1b |
78 | rts | | 89 | rts |
79 | END(_atomic_add_16_nv) | | 90 | END(_atomic_add_16_nv) |
80 | | | 91 | |
81 | STRONG_ALIAS(__sync_add_and_fetch_2,_atomic_add_16_nv) | | 92 | STRONG_ALIAS(__sync_add_and_fetch_2,_atomic_add_16_nv) |
82 | | | 93 | |
| | | 94 | ENTRY(__sync_fetch_and_add_2) |
| | | 95 | movl 4(%sp), %a0 |
| | | 96 | 1: movw (%a0), %d0 |
| | | 97 | movw %d0, %d1 |
| | | 98 | addw 8(%sp), %d1 |
| | | 99 | casw %d0, %d1, (%a0) |
| | | 100 | bne 1b |
| | | 101 | rts |
| | | 102 | END(__sync_fetch_and_add_2) |
| | | 103 | |
83 | ENTRY(_atomic_add_8_nv) | | 104 | ENTRY(_atomic_add_8_nv) |
84 | movl 4(%sp), %a0 | | 105 | movl 4(%sp), %a0 |
85 | 1: movb (%a0), %d0 | | 106 | 1: movb (%a0), %d0 |
86 | movb %d0, %d1 | | 107 | movb %d0, %d1 |
87 | addb 8(%sp), %d0 | | 108 | addb 8(%sp), %d0 |
88 | casb %d1, %d0, (%a0) | | 109 | casb %d1, %d0, (%a0) |
89 | bne 1b | | 110 | bne 1b |
90 | rts | | 111 | rts |
91 | END(_atomic_add_8_nv) | | 112 | END(_atomic_add_8_nv) |
92 | | | 113 | |
93 | STRONG_ALIAS(__sync_add_and_fetch_1,_atomic_add_8_nv) | | 114 | STRONG_ALIAS(__sync_add_and_fetch_1,_atomic_add_8_nv) |
| | | 115 | |
| | | 116 | ENTRY(__sync_fetch_and_add_1) |
| | | 117 | movl 4(%sp), %a0 |
| | | 118 | 1: movb (%a0), %d0 |
| | | 119 | movb %d0, %d1 |
| | | 120 | addb 8(%sp), %d1 |
| | | 121 | casb %d0, %d1, (%a0) |
| | | 122 | bne 1b |
| | | 123 | rts |
| | | 124 | END(__sync_fetch_and_add_1) |
--- src/common/lib/libc/arch/m68k/atomic/atomic_and.S 2013/07/16 23:24:18 1.8
+++ src/common/lib/libc/arch/m68k/atomic/atomic_and.S 2014/02/20 20:39:01 1.9
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: atomic_and.S,v 1.8 2013/07/16 23:24:18 matt Exp $ */ | | 1 | /* $NetBSD: atomic_and.S,v 1.9 2014/02/20 20:39:01 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 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 Jason R. Thorpe. | | 8 | * 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. |
| @@ -44,22 +44,83 @@ ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_ | | | @@ -44,22 +44,83 @@ ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_ |
44 | STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) | | 44 | STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) |
45 | ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) | | 45 | ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) |
46 | STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) | | 46 | STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) |
47 | ATOMIC_OP_ALIAS(atomic_and_ptr,_atomic_and_32) | | 47 | ATOMIC_OP_ALIAS(atomic_and_ptr,_atomic_and_32) |
48 | STRONG_ALIAS(_atomic_and_ptr,_atomic_and_32) | | 48 | STRONG_ALIAS(_atomic_and_ptr,_atomic_and_32) |
49 | | | 49 | |
50 | ENTRY(_atomic_and_32_nv) | | 50 | ENTRY(_atomic_and_32_nv) |
51 | movl 4(%sp), %a0 | | 51 | movl 4(%sp), %a0 |
52 | 1: movl (%a0), %d0 | | 52 | 1: movl (%a0), %d0 |
53 | movl %d0, %d1 | | 53 | movl %d0, %d1 |
54 | andl 8(%sp), %d0 | | 54 | andl 8(%sp), %d0 |
55 | casl %d1, %d0, (%a0) | | 55 | casl %d1, %d0, (%a0) |
56 | bne 1b | | 56 | bne 1b |
| | | 57 | movl %d0, %a0 |
57 | rts | | 58 | rts |
58 | END(_atomic_and_32_nv) | | 59 | END(_atomic_and_32_nv) |
59 | ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) | | 60 | ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) |
60 | ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) | | 61 | ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) |
61 | STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) | | 62 | STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) |
62 | ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) | | 63 | ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) |
63 | STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) | | 64 | STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) |
64 | ATOMIC_OP_ALIAS(atomic_and_ptr_nv,_atomic_and_32_nv) | | 65 | ATOMIC_OP_ALIAS(atomic_and_ptr_nv,_atomic_and_32_nv) |
65 | STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_32_nv) | | 66 | STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_32_nv) |
| | | 67 | STRONG_ALIAS(__sync_and_and_fetch_4,_atomic_and_32_nv) |
| | | 68 | |
| | | 69 | ENTRY(__sync_fetch_and_and_4) |
| | | 70 | movl 4(%sp), %a0 |
| | | 71 | 1: movl (%a0), %d0 |
| | | 72 | movl %d0, %d1 |
| | | 73 | andl 8(%sp), %d1 |
| | | 74 | casl %d0, %d1, (%a0) |
| | | 75 | bne 1b |
| | | 76 | movl %d0, %a0 |
| | | 77 | rts |
| | | 78 | END(__sync_fetch_and_and_4) |
| | | 79 | |
| | | 80 | |
| | | 81 | ENTRY(_atomic_and_16_nv) |
| | | 82 | movl 4(%sp), %a0 |
| | | 83 | 1: movw (%a0), %d0 |
| | | 84 | movw %d0, %d1 |
| | | 85 | andw 8(%sp), %d0 |
| | | 86 | casw %d1, %d0, (%a0) |
| | | 87 | bne 1b |
| | | 88 | rts |
| | | 89 | END(_atomic_and_16_nv) |
| | | 90 | |
| | | 91 | STRONG_ALIAS(__sync_and_and_fetch_2,_atomic_and_16_nv) |
| | | 92 | |
| | | 93 | ENTRY(__sync_fetch_and_and_2) |
| | | 94 | movl 4(%sp), %a0 |
| | | 95 | 1: movw (%a0), %d0 |
| | | 96 | movw %d0, %d1 |
| | | 97 | andw 8(%sp), %d1 |
| | | 98 | casw %d0, %d1, (%a0) |
| | | 99 | bne 1b |
| | | 100 | rts |
| | | 101 | END(__sync_fetch_and_and_2) |
| | | 102 | |
| | | 103 | |
| | | 104 | ENTRY(_atomic_and_8_nv) |
| | | 105 | movl 4(%sp), %a0 |
| | | 106 | 1: movb (%a0), %d0 |
| | | 107 | movb %d0, %d1 |
| | | 108 | andb 8(%sp), %d0 |
| | | 109 | casb %d1, %d0, (%a0) |
| | | 110 | bne 1b |
| | | 111 | rts |
| | | 112 | END(_atomic_and_8_nv) |
| | | 113 | |
| | | 114 | STRONG_ALIAS(__sync_and_and_fetch_1,_atomic_and_8_nv) |
| | | 115 | |
| | | 116 | ENTRY(__sync_fetch_and_and_1) |
| | | 117 | movl 4(%sp), %a0 |
| | | 118 | 1: movb (%a0), %d0 |
| | | 119 | movb %d0, %d1 |
| | | 120 | andb 8(%sp), %d1 |
| | | 121 | casb %d0, %d1, (%a0) |
| | | 122 | bne 1b |
| | | 123 | rts |
| | | 124 | END(__sync_fetch_and_and_1) |
| | | 125 | |
| | | 126 | |
--- src/common/lib/libc/arch/m68k/atomic/atomic_or.S 2013/07/16 23:24:18 1.8
+++ src/common/lib/libc/arch/m68k/atomic/atomic_or.S 2014/02/20 20:39:01 1.9
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: atomic_or.S,v 1.8 2013/07/16 23:24:18 matt Exp $ */ | | 1 | /* $NetBSD: atomic_or.S,v 1.9 2014/02/20 20:39:01 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 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 Jason R. Thorpe. | | 8 | * 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. |
| @@ -29,36 +29,97 @@ | | | @@ -29,36 +29,97 @@ |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include "atomic_op_asm.h" | | 32 | #include "atomic_op_asm.h" |
33 | | | 33 | |
34 | .text | | 34 | .text |
35 | | | 35 | |
36 | ENTRY(_atomic_or_32) | | 36 | ENTRY(_atomic_or_32) |
37 | movl 4(%sp), %a0 | | 37 | movl 4(%sp), %a0 |
38 | movl 8(%sp), %d0 | | 38 | movl 8(%sp), %d0 |
39 | orl %d0, (%a0) | | 39 | orl %d0, (%a0) |
40 | rts | | 40 | rts |
41 | END(_atomic_or_32) | | 41 | END(_atomic_or_32) |
| | | 42 | |
42 | ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) | | 43 | ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) |
43 | ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) | | 44 | ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) |
44 | STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) | | 45 | STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) |
45 | ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) | | 46 | ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) |
46 | STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) | | 47 | STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) |
47 | ATOMIC_OP_ALIAS(atomic_or_ptr,_atomic_or_32) | | 48 | ATOMIC_OP_ALIAS(atomic_or_ptr,_atomic_or_32) |
48 | STRONG_ALIAS(_atomic_or_ptr,_atomic_or_32) | | 49 | STRONG_ALIAS(_atomic_or_ptr,_atomic_or_32) |
49 | | | 50 | |
50 | ENTRY(_atomic_or_32_nv) | | 51 | ENTRY(_atomic_or_32_nv) |
51 | movl 4(%sp), %a0 | | 52 | movl 4(%sp), %a0 |
52 | 1: movl (%a0), %d0 | | 53 | 1: movl (%a0), %d0 |
53 | movl %d0, %d1 | | 54 | movl %d0, %d1 |
54 | orl 8(%sp), %d0 | | 55 | orl 8(%sp), %d0 |
55 | casl %d1, %d0, (%a0) | | 56 | casl %d1, %d0, (%a0) |
56 | bne 1b | | 57 | bne 1b |
| | | 58 | movl %d0, %a0 |
57 | rts | | 59 | rts |
| | | 60 | END(_atomic_or_32_nv) |
| | | 61 | |
58 | ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) | | 62 | ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) |
59 | ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) | | 63 | ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) |
60 | STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) | | 64 | STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) |
61 | ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) | | 65 | ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) |
62 | STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) | | 66 | STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) |
63 | ATOMIC_OP_ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv) | | 67 | ATOMIC_OP_ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv) |
64 | STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv) | | 68 | STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv) |
| | | 69 | STRONG_ALIAS(__sync_or_and_fetch_4, _atomic_or_32_nv) |
| | | 70 | |
| | | 71 | |
| | | 72 | ENTRY(__sync_fetch_and_or_4) |
| | | 73 | movl 4(%sp), %a0 |
| | | 74 | 1: movl (%a0), %d0 |
| | | 75 | movl %d0, %d1 |
| | | 76 | orl 8(%sp), %d1 |
| | | 77 | casl %d0, %d1, (%a0) |
| | | 78 | bne 1b |
| | | 79 | movl %d0, %a0 |
| | | 80 | rts |
| | | 81 | END(__sync_fetch_and_or_4) |
| | | 82 | |
| | | 83 | |
| | | 84 | ENTRY(_atomic_or_16_nv) |
| | | 85 | movl 4(%sp), %a0 |
| | | 86 | 1: movw (%a0), %d0 |
| | | 87 | movw %d0, %d1 |
| | | 88 | orw 8(%sp), %d0 |
| | | 89 | casw %d1, %d0, (%a0) |
| | | 90 | bne 1b |
| | | 91 | rts |
| | | 92 | END(_atomic_or_16_nv) |
| | | 93 | STRONG_ALIAS(__sync_or_and_fetch_2, _atomic_or_16_nv) |
| | | 94 | |
| | | 95 | ENTRY(__sync_fetch_and_or_2) |
| | | 96 | movl 4(%sp), %a0 |
| | | 97 | 1: movw (%a0), %d0 |
| | | 98 | movw %d0, %d1 |
| | | 99 | orw 8(%sp), %d1 |
| | | 100 | casw %d0, %d1, (%a0) |
| | | 101 | bne 1b |
| | | 102 | rts |
| | | 103 | END(__sync_fetch_and_or_2) |
| | | 104 | |
| | | 105 | |
| | | 106 | ENTRY(_atomic_or_8_nv) |
| | | 107 | movl 4(%sp), %a0 |
| | | 108 | 1: movb (%a0), %d0 |
| | | 109 | movb %d0, %d1 |
| | | 110 | orb 8(%sp), %d0 |
| | | 111 | casb %d1, %d0, (%a0) |
| | | 112 | bne 1b |
| | | 113 | rts |
| | | 114 | END(_atomic_or_8_nv) |
| | | 115 | STRONG_ALIAS(__sync_or_and_fetch_1, _atomic_or_8_nv) |
| | | 116 | |
| | | 117 | ENTRY(__sync_fetch_and_or_1) |
| | | 118 | movl 4(%sp), %a0 |
| | | 119 | 1: movb (%a0), %d0 |
| | | 120 | movb %d0, %d1 |
| | | 121 | orb 8(%sp), %d1 |
| | | 122 | casb %d0, %d1, (%a0) |
| | | 123 | bne 1b |
| | | 124 | rts |
| | | 125 | END(__sync_fetch_and_or_1) |
/* $NetBSD: atomic_nand.S,v 1.1 2014/02/20 20:39:01 martin Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "atomic_op_asm.h"
.text
ENTRY(_atomic_nand_32_nv)
movl 4(%sp), %a0
1: movl (%a0), %d0
movl %d0, %d1
andl 8(%sp), %d0
notl %d0
casl %d1, %d0, (%a0)
bne 1b
movl %d0, %a0
rts
END(_atomic_nand_32_nv)
ATOMIC_OP_ALIAS(atomic_nand_32_nv,_atomic_nand_32_nv)
ATOMIC_OP_ALIAS(atomic_nand_uint_nv,_atomic_nand_32_nv)
STRONG_ALIAS(_atomic_nand_uint_nv,_atomic_nand_32_nv)
ATOMIC_OP_ALIAS(atomic_nand_ulong_nv,_atomic_nand_32_nv)
STRONG_ALIAS(_atomic_nand_ulong_nv,_atomic_nand_32_nv)
ATOMIC_OP_ALIAS(atomic_nand_ptr_nv,_atomic_nand_32_nv)
STRONG_ALIAS(_atomic_nand_ptr_nv,_atomic_nand_32_nv)
ATOMIC_OP_ALIAS(atomic_nand_32,_atomic_nand_32_nv)
ATOMIC_OP_ALIAS(atomic_nand_uint,_atomic_nand_32_nv)
STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32_nv)
ATOMIC_OP_ALIAS(atomic_nand_ulong,_atomic_nand_32_nv)
STRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_32_nv)
ATOMIC_OP_ALIAS(atomic_nand_ptr,_atomic_nand_32_nv)
STRONG_ALIAS(_atomic_nand_ptr,_atomic_nand_32_nv)
STRONG_ALIAS(__sync_nand_and_fetch_4,_atomic_nand_32_nv)
ENTRY(__sync_fetch_and_nand_4)
movl 4(%sp), %a0
1: movl (%a0), %d0
movl %d0, %d1
andl 8(%sp), %d1
notl %d1
casl %d0, %d1, (%a0)
bne 1b
movl %d0, %a0
rts
END(__sync_fetch_and_nand_4)
ENTRY(_atomic_nand_16_nv)
movl 4(%sp), %a0
1: movw (%a0), %d0
movw %d0, %d1
andw 8(%sp), %d0
notw %d0
casw %d1, %d0, (%a0)
bne 1b
rts
END(_atomic_nand_16_nv)
STRONG_ALIAS(__sync_nand_and_fetch_2,_atomic_nand_16_nv)
ENTRY(__sync_fetch_and_nand_2)
movl 4(%sp), %a0
1: movw (%a0), %d0
movw %d0, %d1
andw 8(%sp), %d1
notw %d1
casw %d0, %d1, (%a0)
bne 1b
rts
END(__sync_fetch_and_nand_2)
ENTRY(_atomic_nand_8_nv)
movl 4(%sp), %a0
1: movb (%a0), %d0
movb %d0, %d1
andb 8(%sp), %d0
notb %d0
casb %d1, %d0, (%a0)
bne 1b
rts
END(_atomic_nand_8_nv)
STRONG_ALIAS(__sync_nand_and_fetch_1,_atomic_nand_8_nv)
ENTRY(__sync_fetch_and_nand_1)
movl 4(%sp), %a0
1: movb (%a0), %d0
movb %d0, %d1
andb 8(%sp), %d1
notb %d1
casb %d0, %d1, (%a0)
bne 1b
rts
END(__sync_fetch_and_nand_1)
/* $NetBSD: atomic_sub.S,v 1.1 2014/02/20 20:39:01 martin Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "atomic_op_asm.h"
.text
.align 2
ENTRY(_atomic_sub_32)
movl 4(%sp), %a0
movl 8(%sp), %d0
subl %d0, (%a0)
rts
END(_atomic_sub_32)
ATOMIC_OP_ALIAS(atomic_sub_32,_atomic_sub_32)
ATOMIC_OP_ALIAS(atomic_sub_int,_atomic_sub_32)
STRONG_ALIAS(_atomic_sub_int,_atomic_sub_32)
ATOMIC_OP_ALIAS(atomic_sub_long,_atomic_sub_32)
STRONG_ALIAS(_atomic_sub_long,_atomic_sub_32)
ATOMIC_OP_ALIAS(atomic_sub_ptr,_atomic_sub_32)
STRONG_ALIAS(_atomic_sub_ptr,_atomic_sub_32)
ENTRY(_atomic_sub_32_nv)
movl 4(%sp), %a0
1: movl (%a0), %d0
movl %d0, %d1
subl 8(%sp), %d0
casl %d1, %d0, (%a0)
bne 1b
movl %d0, %a0 /* pointers return also in %a0 */
rts
END(_atomic_sub_32_nv)
ATOMIC_OP_ALIAS(atomic_sub_32_nv,_atomic_sub_32_nv)
ATOMIC_OP_ALIAS(atomic_sub_int_nv,_atomic_sub_32_nv)
STRONG_ALIAS(_atomic_sub_int_nv,_atomic_sub_32_nv)
ATOMIC_OP_ALIAS(atomic_sub_long_nv,_atomic_sub_32_nv)
STRONG_ALIAS(_atomic_sub_long_nv,_atomic_sub_32_nv)
ATOMIC_OP_ALIAS(atomic_sub_ptr_nv,_atomic_sub_32_nv)
STRONG_ALIAS(_atomic_sub_ptr_nv,_atomic_sub_32_nv)
STRONG_ALIAS(__sync_sub_and_fetch_4,_atomic_sub_32_nv)
ENTRY(__sync_fetch_and_sub_4)
movl 4(%sp), %a0
1: movl (%a0), %d0
movl %d0, %d1
subl 8(%sp), %d1
casl %d0, %d1, (%a0)
bne 1b
movl %d0, %a0 /* pointers return also in %a0 */
rts
END(__sync_fetch_and_sub_4)
ENTRY(_atomic_sub_16_nv)
movl 4(%sp), %a0
1: movw (%a0), %d0
movw %d0, %d1
subw 8(%sp), %d0
casw %d1, %d0, (%a0)
bne 1b
rts
END(_atomic_sub_16_nv)
STRONG_ALIAS(__sync_sub_and_fetch_2,_atomic_sub_16_nv)
ENTRY(__sync_fetch_and_sub_2)
movl 4(%sp), %a0
1: movw (%a0), %d0
movw %d0, %d1
subw 8(%sp), %d1
casw %d0, %d1, (%a0)
bne 1b
rts
END(__sync_fetch_and_sub_2)
ENTRY(_atomic_sub_8_nv)
movl 4(%sp), %a0
1: movb (%a0), %d0
movb %d0, %d1
subb 8(%sp), %d0
casb %d1, %d0, (%a0)
bne 1b
rts
END(_atomic_sub_8_nv)
STRONG_ALIAS(__sync_sub_and_fetch_1,_atomic_sub_8_nv)
ENTRY(__sync_fetch_and_sub_1)
movl 4(%sp), %a0
1: movb (%a0), %d0
movb %d0, %d1
subb 8(%sp), %d1
casb %d0, %d1, (%a0)
bne 1b
rts
END(__sync_fetch_and_sub_1)
/* $NetBSD: atomic_xor.S,v 1.1 2014/02/20 20:39:01 martin Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "atomic_op_asm.h"
.text
ENTRY(_atomic_xor_32)
movl 4(%sp), %a0
movl 8(%sp), %d0
eorl %d0, (%a0)
rts
END(_atomic_xor_32)
ATOMIC_OP_ALIAS(atomic_xor_32,_atomic_xor_32)
ATOMIC_OP_ALIAS(atomic_xor_uint,_atomic_xor_32)
STRONG_ALIAS(_atomic_xor_uint,_atomic_xor_32)
ATOMIC_OP_ALIAS(atomic_xor_ulong,_atomic_xor_32)
STRONG_ALIAS(_atomic_xor_ulong,_atomic_xor_32)
ATOMIC_OP_ALIAS(atomic_xor_ptr,_atomic_xor_32)
STRONG_ALIAS(_atomic_xor_ptr,_atomic_xor_32)
ENTRY(_atomic_xor_32_nv)
movl 4(%sp), %a0
1: movl (%a0), %d0
movl %d0, %d1
movl 8(%sp), %d2
eorl %d2, %d0
casl %d1, %d0, (%a0)
bne 1b
movl %d0, %a0
rts
END(_atomic_xor_32_nv)
ATOMIC_OP_ALIAS(atomic_xor_32_nv,_atomic_xor_32_nv)
ATOMIC_OP_ALIAS(atomic_xor_uint_nv,_atomic_xor_32_nv)
STRONG_ALIAS(_atomic_xor_uint_nv,_atomic_xor_32_nv)
ATOMIC_OP_ALIAS(atomic_xor_ulong_nv,_atomic_xor_32_nv)
STRONG_ALIAS(_atomic_xor_ulong_nv,_atomic_xor_32_nv)
ATOMIC_OP_ALIAS(atomic_xor_ptr_nv,_atomic_xor_32_nv)
STRONG_ALIAS(_atomic_xor_ptr_nv,_atomic_xor_32_nv)
STRONG_ALIAS(__sync_xor_and_fetch_4, _atomic_xor_32_nv)
ENTRY(__sync_fetch_and_xor_4)
movl 4(%sp), %a0
1: movl (%a0), %d0
movl %d0, %d1
movl 8(%sp), %d2
eorl %d2, %d1
casl %d0, %d1, (%a0)
bne 1b
movl %d0, %a0
rts
END(__sync_fetch_and_xor_4)
ENTRY(_atomic_xor_16_nv)
movl 4(%sp), %a0
1: movw (%a0), %d0
movw %d0, %d1
movw 8(%sp), %d2
eorw %d2, %d0
casw %d1, %d0, (%a0)
bne 1b
rts
END(_atomic_xor_16_nv)
STRONG_ALIAS(__sync_xor_and_fetch_2, _atomic_xor_16_nv)
ENTRY(__sync_fetch_and_xor_2)
movl 4(%sp), %a0
1: movw (%a0), %d0
movw %d0, %d1
movw 8(%sp), %d2
eorw %d2, %d1
casw %d0, %d1, (%a0)
bne 1b
rts
END(__sync_fetch_and_xor_2)
ENTRY(_atomic_xor_8_nv)
movl 4(%sp), %a0
1: movb (%a0), %d0
movb %d0, %d1
movb 8(%sp), %d2
eorb %d2, %d0
casb %d1, %d0, (%a0)
bne 1b
rts
END(_atomic_xor_8_nv)
STRONG_ALIAS(__sync_xor_and_fetch_1, _atomic_xor_8_nv)
ENTRY(__sync_fetch_and_xor_1)
movl 4(%sp), %a0
1: movb (%a0), %d0
movb %d0, %d1
movb 8(%sp), %d2
eorb %d2, %d1
casb %d0, %d1, (%a0)
bne 1b
rts
END(__sync_fetch_and_xor_1)