| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: atomic_cas_up.S,v 1.7 2014/03/04 03:36:24 matt Exp $ */ | | 1 | /* $NetBSD: atomic_cas_up.S,v 1.8 2020/03/09 11:21:54 skrll Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 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 Steve C. Woodford. | | 8 | * by Steve C. Woodford. |
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. |
| @@ -31,26 +31,27 @@ | | | @@ -31,26 +31,27 @@ |
31 | | | 31 | |
32 | #include <sys/ras.h> | | 32 | #include <sys/ras.h> |
33 | #include <machine/asm.h> | | 33 | #include <machine/asm.h> |
34 | | | 34 | |
35 | ENTRY(_atomic_cas_up) | | 35 | ENTRY(_atomic_cas_up) |
36 | .hidden _C_LABEL(_atomic_cas_up) | | 36 | .hidden _C_LABEL(_atomic_cas_up) |
37 | mov r3, r0 | | 37 | mov r3, r0 |
38 | .align 0 | | 38 | .align 0 |
39 | RAS_START_ASM_HIDDEN(_atomic_cas) | | 39 | RAS_START_ASM_HIDDEN(_atomic_cas) |
40 | ldr r0, [r3] | | 40 | ldr r0, [r3] |
41 | cmp r0, r1 | | 41 | cmp r0, r1 |
42 | #if defined(__thumb__) | | 42 | #if defined(__thumb__) |
43 | beq 1f | | 43 | beq 1f |
| | | 44 | str r2, [r3] |
44 | #else | | 45 | #else |
45 | streq r2, [r3] | | 46 | streq r2, [r3] |
46 | #endif | | 47 | #endif |
47 | .align 0 | | 48 | .align 0 |
48 | RAS_END_ASM_HIDDEN(_atomic_cas) | | 49 | RAS_END_ASM_HIDDEN(_atomic_cas) |
49 | 1: RET | | 50 | 1: RET |
50 | END(_atomic_cas_up) | | 51 | END(_atomic_cas_up) |
51 | | | 52 | |
52 | #if defined(__HAVE_ASM_ATOMIC_CAS_64_UP) | | 53 | #if defined(__HAVE_ASM_ATOMIC_CAS_64_UP) |
53 | ARM_ENTRY(_atomic_cas_64_up) | | 54 | ARM_ENTRY(_atomic_cas_64_up) |
54 | push {r4-r5} | | 55 | push {r4-r5} |
55 | mov ip, r0 | | 56 | mov ip, r0 |
56 | ldrd r4, r5, [sp, #8] | | 57 | ldrd r4, r5, [sp, #8] |
| @@ -65,36 +66,38 @@ RAS_END_ASM_HIDDEN(_atomic_cas_64) | | | @@ -65,36 +66,38 @@ RAS_END_ASM_HIDDEN(_atomic_cas_64) |
65 | 1: pop {r4-r5} | | 66 | 1: pop {r4-r5} |
66 | bx lr | | 67 | bx lr |
67 | END(_atomic_cas_64_up) | | 68 | END(_atomic_cas_64_up) |
68 | #endif /* __HAVE_ASM_ATOMIC_64_UP */ | | 69 | #endif /* __HAVE_ASM_ATOMIC_64_UP */ |
69 | | | 70 | |
70 | ENTRY(_atomic_cas_16_up) | | 71 | ENTRY(_atomic_cas_16_up) |
71 | mov r3, r0 | | 72 | mov r3, r0 |
72 | .align 0 | | 73 | .align 0 |
73 | RAS_START_ASM_HIDDEN(_atomic_cas_16) | | 74 | RAS_START_ASM_HIDDEN(_atomic_cas_16) |
74 | ldrh r0, [r3] | | 75 | ldrh r0, [r3] |
75 | cmp r0, r1 | | 76 | cmp r0, r1 |
76 | #if defined(__thumb__) | | 77 | #if defined(__thumb__) |
77 | beq 1f | | 78 | beq 1f |
| | | 79 | strh r2, [r3] |
78 | #else | | 80 | #else |
79 | strheq r2, [r3] | | 81 | strheq r2, [r3] |
80 | #endif | | 82 | #endif |
81 | .align 0 | | 83 | .align 0 |
82 | RAS_END_ASM_HIDDEN(_atomic_cas_16) | | 84 | RAS_END_ASM_HIDDEN(_atomic_cas_16) |
83 | 1: RET | | 85 | 1: RET |
84 | END(_atomic_cas_16_up) | | 86 | END(_atomic_cas_16_up) |
85 | | | 87 | |
86 | ENTRY(_atomic_cas_8_up) | | 88 | ENTRY(_atomic_cas_8_up) |
87 | mov r3, r0 | | 89 | mov r3, r0 |
88 | .align 0 | | 90 | .align 0 |
89 | RAS_START_ASM_HIDDEN(_atomic_cas_8) | | 91 | RAS_START_ASM_HIDDEN(_atomic_cas_8) |
90 | ldrb r0, [r3] | | 92 | ldrb r0, [r3] |
91 | cmp r0, r1 | | 93 | cmp r0, r1 |
92 | #if defined(__thumb__) | | 94 | #if defined(__thumb__) |
93 | beq 1f | | 95 | beq 1f |
| | | 96 | strb r2, [r3] |
94 | #else | | 97 | #else |
95 | strbeq r2, [r3] | | 98 | strbeq r2, [r3] |
96 | #endif | | 99 | #endif |
97 | .align 0 | | 100 | .align 0 |
98 | RAS_END_ASM_HIDDEN(_atomic_cas_8) | | 101 | RAS_END_ASM_HIDDEN(_atomic_cas_8) |
99 | 1: RET | | 102 | 1: RET |
100 | END(_atomic_cas_8_up) | | 103 | END(_atomic_cas_8_up) |