| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: fusu.S,v 1.5 2019/04/06 03:06:24 thorpej Exp $ */ | | 1 | /* $NetBSD: fusu.S,v 1.6 2019/04/07 04:11:56 thorpej Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2019 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2019 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. |
| @@ -89,121 +89,118 @@ | | | @@ -89,121 +89,118 @@ |
89 | | | 89 | |
90 | /* LINTSTUB: int _ufetch_8(const uint8_t *uaddr, uint8_t *valp); */ | | 90 | /* LINTSTUB: int _ufetch_8(const uint8_t *uaddr, uint8_t *valp); */ |
91 | | | 91 | |
92 | ENTRY(_ufetch_8) | | 92 | ENTRY(_ufetch_8) |
93 | UFETCHSTORE_PROLOGUE | | 93 | UFETCHSTORE_PROLOGUE |
94 | | | 94 | |
95 | ldrbt r3, [r0] | | 95 | ldrbt r3, [r0] |
96 | strb r3, [r1] | | 96 | strb r3, [r1] |
97 | | | 97 | |
98 | UFETCHSTORE_EPILOGUE | | 98 | UFETCHSTORE_EPILOGUE |
99 | RETURN_SUCCESS | | 99 | RETURN_SUCCESS |
100 | END(_ufetch_8) | | 100 | END(_ufetch_8) |
101 | | | 101 | |
102 | #if (ARM_ARCH_2 + ARM_ARCH_3) > 0 | | 102 | #if (ARM_ARCH_2 + ARM_ARCH_3 + ARM_ARCH_4 + ARM_ARCH_5) > 0 |
103 | /* LINTSTUB: int _ufetch_16_armv2(const uint16_t *uaddr, uint16_t *valp); */ | | 103 | /* LINTSTUB: int _ufetch_16_armv2(const uint16_t *uaddr, uint16_t *valp); */ |
104 | ENTRY(_ufetch_16_armv2) | | 104 | ENTRY(_ufetch_16_armv2) |
105 | UFETCHSTORE_PROLOGUE | | 105 | UFETCHSTORE_PROLOGUE |
106 | | | 106 | |
107 | ldrbt r3, [r0], #1 | | 107 | ldrbt r3, [r0], #1 |
108 | strb r3, [r1], #1 | | 108 | strb r3, [r1], #1 |
109 | | | 109 | |
110 | ldrbt r3, [r0] | | 110 | ldrbt r3, [r0] |
111 | strb r3, [r1] | | 111 | strb r3, [r1] |
112 | | | 112 | |
113 | UFETCHSTORE_EPILOGUE | | 113 | UFETCHSTORE_EPILOGUE |
114 | RETURN_SUCCESS | | 114 | RETURN_SUCCESS |
115 | END(_ufetch_16_armv2) | | 115 | END(_ufetch_16_armv2) |
116 | | | 116 | |
| | | 117 | /* LINTSTUB: int _ufetch_16(const uint16_t *uaddr, uint16_t *valp); */ |
| | | 118 | STRONG_ALIAS(_ufetch_16,_ufetch_16_armv2) |
| | | 119 | |
117 | #else /* XXX */ | | 120 | #else /* XXX */ |
118 | | | 121 | |
119 | /* LINTSTUB: int _ufetch_16_armv4(const uint16_t *uaddr, uint16_t *valp); */ | | 122 | /* LINTSTUB: int _ufetch_16_armv6(const uint16_t *uaddr, uint16_t *valp); */ |
120 | ENTRY(_ufetch_16_armv4) | | 123 | ENTRY(_ufetch_16_armv6) |
121 | UFETCHSTORE_PROLOGUE | | 124 | UFETCHSTORE_PROLOGUE |
122 | | | 125 | |
123 | ldrht r3, [r0] | | 126 | ldrht r3, [r0] |
124 | strh r3, [r1] | | 127 | strh r3, [r1] |
125 | | | 128 | |
126 | UFETCHSTORE_EPILOGUE | | 129 | UFETCHSTORE_EPILOGUE |
127 | RETURN_SUCCESS | | 130 | RETURN_SUCCESS |
128 | END(_ufetch_16_armv4) | | 131 | END(_ufetch_16_armv6) |
129 | #endif /* (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0 */ | | | |
130 | | | 132 | |
131 | /* LINTSTUB: int _ufetch_16(const uint16_t *uaddr, uint16_t *valp); */ | | 133 | /* LINTSTUB: int _ufetch_16(const uint16_t *uaddr, uint16_t *valp); */ |
132 | #if (ARM_ARCH_2 + ARM_ARCH_3) > 0 | | 134 | STRONG_ALIAS(_ufetch_16,_ufetch_16_armv6) |
133 | STRONG_ALIAS(_ufetch_16,_ufetch_16_armv2) | | 135 | #endif /* (ARM_ARCH_2 + ARM_ARCH_3 + ARM_ARCH_4 + ARM_ARCH_5) > 0 */ |
134 | #else | | | |
135 | STRONG_ALIAS(_ufetch_16,_ufetch_16_armv4) | | | |
136 | #endif /* #if (ARM_ARCH_2 + ARM_ARCH_3) > 0 */ | | | |
137 | | | 136 | |
138 | /* LINTSTUB: int _ufetch_32(const uint32_t *uaddr, uint32_t *valp); */ | | 137 | /* LINTSTUB: int _ufetch_32(const uint32_t *uaddr, uint32_t *valp); */ |
139 | ENTRY(_ufetch_32) | | 138 | ENTRY(_ufetch_32) |
140 | UFETCHSTORE_PROLOGUE | | 139 | UFETCHSTORE_PROLOGUE |
141 | | | 140 | |
142 | ldrt r3, [r0] | | 141 | ldrt r3, [r0] |
143 | str r3, [r1] | | 142 | str r3, [r1] |
144 | | | 143 | |
145 | UFETCHSTORE_EPILOGUE | | 144 | UFETCHSTORE_EPILOGUE |
146 | RETURN_SUCCESS | | 145 | RETURN_SUCCESS |
147 | END(_ufetch_32) | | 146 | END(_ufetch_32) |
148 | | | 147 | |
149 | /* LINTSTUB: int _ustore_8(uint8_t *uaddr, uint8_t val); */ | | 148 | /* LINTSTUB: int _ustore_8(uint8_t *uaddr, uint8_t val); */ |
150 | ENTRY(_ustore_8) | | 149 | ENTRY(_ustore_8) |
151 | UFETCHSTORE_PROLOGUE | | 150 | UFETCHSTORE_PROLOGUE |
152 | | | 151 | |
153 | strbt r1, [r0] | | 152 | strbt r1, [r0] |
154 | | | 153 | |
155 | UFETCHSTORE_EPILOGUE | | 154 | UFETCHSTORE_EPILOGUE |
156 | RETURN_SUCCESS | | 155 | RETURN_SUCCESS |
157 | END(_ustore_8) | | 156 | END(_ustore_8) |
158 | | | 157 | |
159 | #if (ARM_ARCH_2 + ARM_ARCH_3) > 0 | | 158 | #if (ARM_ARCH_2 + ARM_ARCH_3 + ARM_ARCH_4 + ARM_ARCH_5) > 0 |
160 | /* LINTSTUB: int _ustore_16_armv2(uint16_t *uaddr, uint16_t val); */ | | 159 | /* LINTSTUB: int _ustore_16_armv2(uint16_t *uaddr, uint16_t val); */ |
161 | ENTRY(_ustore_16_armv2) | | 160 | ENTRY(_ustore_16_armv2) |
162 | UFETCHSTORE_PROLOGUE | | 161 | UFETCHSTORE_PROLOGUE |
163 | | | 162 | |
164 | #ifdef __ARMEB__ | | 163 | #ifdef __ARMEB__ |
165 | mov r3, r1, lsr #8 | | 164 | mov r3, r1, lsr #8 |
166 | strbt r3, [r0], #1 | | 165 | strbt r3, [r0], #1 |
167 | #else | | 166 | #else |
168 | strbt r1, [r0], #1 | | 167 | strbt r1, [r0], #1 |
169 | mov r1, r1, lsr #8 | | 168 | mov r1, r1, lsr #8 |
170 | #endif | | 169 | #endif |
171 | strbt r1, [r0] | | 170 | strbt r1, [r0] |
172 | | | 171 | |
173 | UFETCHSTORE_EPILOGUE | | 172 | UFETCHSTORE_EPILOGUE |
174 | RETURN_SUCCESS | | 173 | RETURN_SUCCESS |
175 | END(_ustore_16_armv2) | | 174 | END(_ustore_16_armv2) |
176 | | | 175 | |
| | | 176 | /* LINTSTUB: int _ustore_16(uint16_t *uaddr, uint16_t val); */ |
| | | 177 | STRONG_ALIAS(_ustore_16,_ustore_16_armv2) |
| | | 178 | |
177 | #else /* XXX */ | | 179 | #else /* XXX */ |
178 | | | 180 | |
179 | /* LINTSTUB: int _ustore_16_armv4(uint16_t *uaddr, uint16_t val); */ | | 181 | /* LINTSTUB: int _ustore_16_armv4(uint16_t *uaddr, uint16_t val); */ |
180 | ENTRY(_ustore_16_armv4) | | 182 | ENTRY(_ustore_16_armv6) |
181 | UFETCHSTORE_PROLOGUE | | 183 | UFETCHSTORE_PROLOGUE |
182 | | | 184 | |
183 | strht r1, [r0] | | 185 | strht r1, [r0] |
184 | | | 186 | |
185 | UFETCHSTORE_EPILOGUE | | 187 | UFETCHSTORE_EPILOGUE |
186 | RETURN_SUCCESS | | 188 | RETURN_SUCCESS |
187 | END(_ustore_16_armv4) | | 189 | END(_ustore_16_armv6) |
188 | #endif /* (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0 */ | | | |
189 | | | 190 | |
190 | /* LINTSTUB: int _ustore_16(uint16_t *uaddr, uint16_t val); */ | | 191 | /* LINTSTUB: int _ustore_16(uint16_t *uaddr, uint16_t val); */ |
191 | /* XXXJRT Run-time upgrade to armv4 version would be nice. */ | | 192 | STRONG_ALIAS(_ustore_16,_ustore_16_armv6) |
192 | #if (ARM_ARCH_2 + ARM_ARCH_3) > 0 | | 193 | #endif /* (ARM_ARCH_2 + ARM_ARCH_3 + ARM_ARCH_4 + ARM_ARCH_5) > 0 */ |
193 | STRONG_ALIAS(_ustore_16,_ustore_16_armv2) | | | |
194 | #else | | | |
195 | STRONG_ALIAS(_ustore_16,_ustore_16_armv4) | | | |
196 | #endif /* #if (ARM_ARCH_2 + ARM_ARCH_3) > 0 */ | | | |
197 | | | 194 | |
198 | /* LINTSTUB: int _ustore_32(uint32_t *uaddr, uint32_t val); */ | | 195 | /* LINTSTUB: int _ustore_32(uint32_t *uaddr, uint32_t val); */ |
199 | ENTRY(_ustore_32) | | 196 | ENTRY(_ustore_32) |
200 | UFETCHSTORE_PROLOGUE | | 197 | UFETCHSTORE_PROLOGUE |
201 | | | 198 | |
202 | strt r1, [r0] | | 199 | strt r1, [r0] |
203 | | | 200 | |
204 | UFETCHSTORE_EPILOGUE | | 201 | UFETCHSTORE_EPILOGUE |
205 | RETURN_SUCCESS | | 202 | RETURN_SUCCESS |
206 | END(_ustore_32) | | 203 | END(_ustore_32) |
207 | | | 204 | |
208 | ENTRY_NP(ufetchstore_fault) | | 205 | ENTRY_NP(ufetchstore_fault) |
209 | UFETCHSTORE_EPILOGUE | | 206 | UFETCHSTORE_EPILOGUE |