1 /* $NetBSD: pio_subr.S,v 1.11 2008/02/14 19:41:54 garbled Exp $ */
4 * Copyright (c) 2003 Matt Thomas
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * We use rotlw instead of slw because rotlw ignores bit 26 and slw
33 * doesn't. However, this may make the high bits of the offset rotate
34 * in the low bits but if that happens then the offset was too large
40 #define DBGSYNC /* nothing */
42 /* LINTSTUB: include <sys/param.h> */
43 /* LINTSTUB: include <sys/types.h> */
44 /* LINTSTUB: include <machine/bus.h> */
46 /* LINTSTUB: Func: void out8(volatile u_int8_t *a, u_int8_t v) */
50 eieio /* memory barrier (reorder protection) */
51 DBGSYNC /* force exceptions */
54 /* LINTSTUB: Func: void bsw1_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t v) */
55 /* LINTSTUB: Func: void bsw1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t v) */
58 lwz %r0,0(%r3) /* get log2(stride) */
59 rotlw %r5,%r5,%r0 /* shift offset */
61 stbx %r6,%r4,%r5 /* store value */
62 eieio /* memory barrier (reorder protection) */
63 DBGSYNC /* force exceptions */
66 /* LINTSTUB: Func: void out16(volatile u_int16_t *a, u_int16_t v) */
70 eieio /* memory barrier (reorder protection) */
71 DBGSYNC /* force exceptions */
74 /* LINTSTUB: Func: void bsw2_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t v) */
75 /* LINTSTUB: Func: void bsw2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t v) */
78 lwz %r0,0(%r3) /* get log2(stride) */
79 rotlw %r5,%r5,%r0 /* shift offset */
81 sthx %r6,%r4,%r5 /* store value */
82 eieio /* memory barrier (reorder protection) */
83 DBGSYNC /* force exceptions */
86 /* LINTSTUB: Func: void out32(volatile u_int32_t *a, u_int32_t v) */
90 eieio /* memory barrier (reorder protection) */
91 DBGSYNC /* force exceptions */
94 /* LINTSTUB: Func: void bsw4_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t v) */
95 /* LINTSTUB: Func: void bsw4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t v) */
98 lwz %r0,0(%r3) /* get log2(stride) */
99 rotlw %r5,%r5,%r0 /* shift offset */
101 stwx %r6,%r4,%r5 /* store value */
102 eieio /* memory barrier (reorder protection) */
103 DBGSYNC /* force exceptions */
106 /* LINTSTUB: Func: void bsw8_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t v) */
107 /* LINTSTUB: Func: void bsw8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t v) */
109 lwz %r0,0(%r3) /* get log2(stride) */
110 rotlw %r5,%r5,%r0 /* shift offset */
113 stdx %r6,%r4,%r5 /* store value */
117 eieio /* memory barrier (reorder protection) */
118 DBGSYNC /* force exceptions */
121 /* LINTSTUB: Func: void out16rb(volatile u_int16_t *a, u_int16_t v) */
125 eieio /* memory barrier (reorder protection) */
126 DBGSYNC /* force exceptions */
129 /* LINTSTUB: Func: void bsw2rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t v) */
130 /* LINTSTUB: Func: void bsw2rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t v) */
134 lwz %r0,0(%r3) /* get log2(stride) */
135 rotlw %r5,%r5,%r0 /* shift offset */
137 sthbrx %r6,%r4,%r5 /* store value */
138 eieio /* memory barrier (reorder protection) */
139 DBGSYNC /* force exceptions */
142 /* LINTSTUB: Func: void out32rb(volatile u_int32_t *a, u_int32_t v) */
146 eieio /* memory barrier (reorder protection) */
147 DBGSYNC /* force exceptions */
150 /* LINTSTUB: Func: void bsw4rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t v) */
151 /* LINTSTUB: Func: void bsw4rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t v) */
154 lwz %r0,0(%r3) /* get log2(stride) */
155 rotlw %r5,%r5,%r0 /* shift offset */
157 stwbrx %r6,%r4,%r5 /* store value */
158 eieio /* memory barrier (reorder protection) */
159 DBGSYNC /* force exceptions */
162 /* LINTSTUB: Func: void bsw8rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t v) */
163 /* LINTSTUB: Func: void bsw8rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t v) */
166 lwz %r0,0(%r3) /* get log2(stride) */
167 rotlw %r5,%r5,%r0 /* shift offset */
170 stdbrx %r6,%r4,%r5 /* store value */
174 eieio /* memory barrier (reorder protection) */
175 DBGSYNC /* force exceptions */
178 /* LINTSTUB: Func: int in8(const volatile u_int8_t *a) */
182 eieio /* memory barrier (reorder protection) */
183 DBGSYNC /* force exceptions */
186 /* LINTSTUB: Func: int bsr1_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
187 /* LINTSTUB: Func: int bsr1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
190 lwz %r0,0(%r3) /* get log2(stride) */
191 rotlw %r5,%r5,%r0 /* shift offset */
193 lbzx %r3,%r4,%r5 /* load value */
194 eieio /* memory barrier (reorder protection) */
195 DBGSYNC /* force exceptions */
198 /* LINTSTUB: Func: int in16(const volatile u_int16_t *a) */
202 eieio /* memory barrier (reorder protection) */
203 DBGSYNC /* force exceptions */
206 /* LINTSTUB: Func: int bsr2_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
207 /* LINTSTUB: Func: int bsr2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
210 lwz %r0,0(%r3) /* get log2(stride) */
211 rotlw %r5,%r5,%r0 /* shift offset */
213 lhzx %r3,%r4,%r5 /* load value */
214 eieio /* memory barrier (reorder protection) */
215 DBGSYNC /* force exceptions */
218 /* LINTSTUB: Func: int in32(const volatile u_int32_t *a) */
222 eieio /* memory barrier (reorder protection) */
223 DBGSYNC /* force exceptions */
226 /* LINTSTUB: Func: int bsr4_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
227 /* LINTSTUB: Func: int bsr4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
230 lwz %r0,0(%r3) /* get log2(stride) */
231 rotlw %r5,%r5,%r0 /* shift offset */
233 lwzx %r3,%r4,%r5 /* load value */
234 eieio /* memory barrier (reorder protection) */
235 DBGSYNC /* force exceptions */
238 /* LINTSTUB: Func: u_int64_t bsr8_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
239 /* LINTSTUB: Func: u_int64_t bsr8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
242 lwz %r0,0(%r3) /* get log2(stride) */
243 rotlw %r5,%r5,%r0 /* shift offset */
246 lwdx %r3,%r4,%r5 /* load value */
250 eieio /* memory barrier (reorder protection) */
251 DBGSYNC /* force exceptions */
254 /* LINTSTUB: Func: int in16rb(const volatile u_int16_t *a) */
258 eieio /* memory barrier (reorder protection) */
259 DBGSYNC /* force exceptions */
262 /* LINTSTUB: Func: int bsr2rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
263 /* LINTSTUB: Func: int bsr2rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
266 lwz %r0,0(%r3) /* get log2(stride) */
267 rotlw %r5,%r5,%r0 /* shift offset */
269 lhbrx %r3,%r4,%r5 /* load value */
270 eieio /* memory barrier (reorder protection) */
271 DBGSYNC /* force exceptions */
274 /* LINTSTUB: Func: int in32rb(const volatile u_int32_t *a) */
278 eieio /* memory barrier (reorder protection) */
279 DBGSYNC /* force exceptions */
282 /* LINTSTUB: Func: int bsr4rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
283 /* LINTSTUB: Func: int bsr4rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
286 lwz %r0,0(%r3) /* get log2(stride) */
287 rotlw %r5,%r5,%r0 /* shift offset */
289 lwbrx %r3,%r4,%r5 /* load value */
290 eieio /* memory barrier (reorder protection) */
291 DBGSYNC /* force exceptions */
294 /* LINTSTUB: Func: u_int64_t bsr8rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
295 /* LINTSTUB: Func: u_int64_t bsr8rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) */
298 lwz %r0,0(%r3) /* get log2(stride) */
299 rotlw %r5,%r5,%r0 /* shift offset */
302 ldbrx %r3,%r4,%r5 /* load value */
306 eieio /* memory barrier (reorder protection) */
307 DBGSYNC /* force exceptions */
310 /* LINTSTUB: Func: void bswm1_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int8_t *addr, bus_size_t len) */
311 /* LINTSTUB: Func: void bswm1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int8_t *addr, bus_size_t len) */
312 /* LINTSTUB: Func: void outs8(volatile u_int8_t *dst, const u_int8_t *src, size_t len) */
315 lwz %r0,0(%r3) /* get log2(stride) */
316 rotlw %r5,%r5,%r0 /* shift offset */
318 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
319 mr %r4,%r6 /* move addr to argument 1 register */
320 mr %r5,%r7 /* move count to argument 2 register */
322 cmpwi %r5,0 /* len == 0? */
323 beqlr- /* return if len == 0 */
324 addi %r5,%r5,-1 /* len -= 1 */
325 add %r5,%r5,%r4 /* len += src */
326 addi %r4,%r4,-1 /* pre-decrement */
327 1: lbzu %r0,1(%r4) /* load and increment */
328 stb %r0,0(%r3) /* store */
329 cmpl 0,%r4,%r5 /* at the end? */
330 bne+ 1b /* nope, do another pass */
331 eieio /* memory barrier (reorder protection) */
332 DBGSYNC /* force exceptions */
335 /* LINTSTUB: Func: void bswm2_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t *addr, bus_size_t len) */
336 /* LINTSTUB: Func: void bswm2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t *addr, bus_size_t len) */
337 /* LINTSTUB: Func: void outs16(volatile u_int16_t *dst, const u_int16_t *src, size_t len) */
340 lwz %r0,0(%r3) /* get log2(stride) */
341 rotlw %r5,%r5,%r0 /* shift offset */
343 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
344 mr %r4,%r6 /* move addr to argument 1 register */
345 mr %r5,%r7 /* move count to argument 2 register */
347 cmpwi %r5,0 /* len == 0? */
348 beqlr- /* return if len == 0 */
349 addi %r5,%r5,-1 /* len -= 1 */
350 slwi %r5,%r5,1 /* len *= 2 */
351 add %r5,%r5,%r4 /* len += src */
352 addi %r4,%r4,-2 /* pre-decrement */
353 1: lhzu %r0,2(%r4) /* load and increment */
354 sth %r0,0(%r3) /* store */
355 cmpl 0,%r4,%r5 /* at the end? */
356 bne+ 1b /* nope, do another pass */
357 eieio /* memory barrier (reorder protection) */
358 DBGSYNC /* force exceptions */
361 /* LINTSTUB: Func: void bswm4_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t *addr, bus_size_t len) */
362 /* LINTSTUB: Func: void bswm4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t *addr, bus_size_t len) */
363 /* LINTSTUB: Func: void outs32(volatile u_int32_t *dst, const u_int32_t *src, size_t len) */
366 lwz %r0,0(%r3) /* get log2(stride) */
367 rotlw %r5,%r5,%r0 /* shift offset */
369 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
370 mr %r4,%r6 /* move addr to argument 1 register */
371 mr %r5,%r7 /* move count to argument 2 register */
373 cmpwi %r5,0 /* len == 0? */
374 beqlr- /* return if len == 0 */
375 addi %r5,%r5,-1 /* len -= 1 */
376 slwi %r5,%r5,2 /* len *= 4 */
377 add %r5,%r5,%r4 /* len += src */
378 addi %r4,%r4,-4 /* pre-decrement */
379 1: lwzu %r0,4(%r4) /* load and increment */
380 stw %r0,0(%r3) /* store */
381 cmpl 0,%r4,%r5 /* at the end? */
382 bne+ 1b /* nope, do another pass */
383 eieio /* memory barrier (reorder protection) */
384 DBGSYNC /* force exceptions */
387 /* LINTSTUB: Func: void bswm8_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t *addr, bus_size_t len) */
388 /* LINTSTUB: Func: void bswm8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t *addr, bus_size_t len) */
392 ld %r0,0(%r3) /* get log2(stride) */
393 rotld %r5,%r5,%r0 /* shift offset */
395 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
396 mr %r4,%r6 /* move addr to argument 1 register */
397 mr %r5,%r7 /* move count to argument 2 register */
399 cmpdi %r5,0 /* len == 0? */
400 beqlr- /* return if len == 0 */
401 addi %r5,%r5,-1 /* len -= 1 */
402 sldi %r5,%r5,2 /* len *= 4 */
403 add %r5,%r5,%r4 /* len += src */
404 addi %r4,%r4,-4 /* pre-decrement */
405 1: ldzu %r0,4(%r4) /* load and increment */
406 std %r0,0(%r3) /* store */
407 cmpl 0,%r4,%r5 /* at the end? */
408 bne+ 1b /* nope, do another pass */
409 eieio /* memory barrier (reorder protection) */
410 DBGSYNC /* force exceptions */
418 /* LINTSTUB: Func: void bswm2rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t *addr, bus_size_t len) */
419 /* LINTSTUB: Func: void bswm2rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t *addr, bus_size_t len) */
420 /* LINTSTUB: Func: void outs16rb(volatile u_int16_t *dst, const u_int16_t *src, size_t len) */
423 lwz %r0,0(%r3) /* get log2(stride) */
424 rotlw %r5,%r5,%r0 /* shift offset */
426 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
427 mr %r4,%r6 /* move addr to argument 1 register */
428 mr %r5,%r7 /* move count to argument 2 register */
430 cmpwi %r5,0 /* len == 0? */
431 beqlr- /* return if len == 0 */
432 addi %r5,%r5,-1 /* len -= 1 */
433 slwi %r5,%r5,1 /* len *= 2 */
434 add %r5,%r5,%r4 /* len += src */
435 addi %r4,%r4,-2 /* pre-decrement */
436 1: lwzu %r0,2(%r4) /* load and increment */
437 sthbrx %r0,0,%r3 /* store (byte-reversed) */
438 cmpl 0,%r4,%r5 /* at the end? */
439 bne+ 1b /* nope, do another pass */
440 eieio /* memory barrier (reorder protection) */
441 DBGSYNC /* force exceptions */
444 /* LINTSTUB: Func: void bswm4rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t *addr, bus_size_t len) */
445 /* LINTSTUB: Func: void bswm4rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t *addr, bus_size_t len) */
446 /* LINTSTUB: Func: void outs32rb(volatile u_int32_t *dst, const u_int32_t *src, size_t len) */
449 lwz %r0,0(%r3) /* get log2(stride) */
450 rotlw %r5,%r5,%r0 /* shift offset */
452 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
453 mr %r4,%r6 /* move addr to argument 1 register */
454 mr %r5,%r7 /* move count to argument 2 register */
456 cmpwi %r5,0 /* len == 0? */
457 beqlr- /* return if len == 0 */
458 addi %r5,%r5,-1 /* len -= 1 */
459 slwi %r5,%r5,2 /* len *= 4 */
460 add %r5,%r5,%r4 /* len += src */
461 addi %r4,%r4,-4 /* pre-decrement */
462 1: lwzu %r0,4(%r4) /* load and increment */
463 stwbrx %r0,0,%r3 /* store (byte-reversed) */
464 cmpl 0,%r4,%r5 /* at the end? */
465 bne+ 1b /* nope, do another pass */
466 eieio /* memory barrier (reorder protection) */
467 DBGSYNC /* force exceptions */
470 /* LINTSTUB: Func: void bswm8rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t *addr, bus_size_t len) */
471 /* LINTSTUB: Func: void bswm8rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t *addr, bus_size_t len) */
476 /* LINTSTUB: Func: void bsrm1_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t *addr, bus_size_t len) */
477 /* LINTSTUB: Func: void bsrm1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t *addr, bus_size_t len) */
478 /* LINTSTUB: Func: void ins8(const volatile u_int8_t *src, u_int8_t *dst, size_t len) */
481 lwz %r0,0(%r3) /* get log2(stride) */
482 rotlw %r5,%r5,%r0 /* shift offset */
484 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
485 mr %r4,%r6 /* move addr to argument 1 register */
486 mr %r5,%r7 /* move count to argument 2 register */
488 cmpwi %r5,0 /* len == 0? */
489 beqlr- /* return if len == 0 */
490 addi %r5,%r5,-1 /* len -= 1 */
491 add %r5,%r5,%r4 /* len += src */
492 addi %r4,%r4,-1 /* pre-decrement */
493 1: lbz %r0,0(%r3) /* load value */
494 stbu %r0,1(%r4) /* store and increment */
495 cmpl 0,%r4,%r5 /* at the end? */
496 bne+ 1b /* nope, do another pass */
497 eieio /* memory barrier (reorder protection) */
498 DBGSYNC /* force exceptions */
501 /* LINTSTUB: Func: void bsrm2_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t *addr, bus_size_t len) */
502 /* LINTSTUB: Func: void bsrm2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t *addr, bus_size_t len) */
503 /* LINTSTUB: Func: void ins16(const volatile u_int16_t *src, u_int16_t *dst, size_t len) */
506 lwz %r0,0(%r3) /* get log2(stride) */
507 rotlw %r5,%r5,%r0 /* shift offset */
509 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
510 mr %r4,%r6 /* move addr to argument 1 register */
511 mr %r5,%r7 /* move count to argument 2 register */
513 cmpwi %r5,0 /* len == 0? */
514 beqlr- /* return if len == 0 */
515 addi %r5,%r5,-1 /* len -= 1 */
516 slwi %r5,%r5,1 /* len *= 2 */
517 add %r5,%r5,%r4 /* len += src */
518 addi %r4,%r4,-2 /* pre-decrement */
519 1: lhz %r0,0(%r3) /* load value */
520 sthu %r0,2(%r4) /* store and increment */
521 cmpl 0,%r4,%r5 /* at the end? */
522 bne+ 1b /* nope, do another pass */
523 eieio /* memory barrier (reorder protection) */
524 DBGSYNC /* force exceptions */
527 /* LINTSTUB: Func: void bsrm4_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t *addr, bus_size_t len) */
528 /* LINTSTUB: Func: void bsrm4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t *addr, bus_size_t len) */
529 /* LINTSTUB: Func: void ins32(const volatile u_int32_t *src, u_int32_t *dst, size_t len) */
532 lwz %r0,0(%r3) /* get log2(stride) */
533 rotlw %r5,%r5,%r0 /* shift offset */
535 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
536 mr %r4,%r6 /* move addr to argument 1 register */
537 mr %r5,%r7 /* move count to argument 2 register */
539 cmpwi %r5,0 /* len == 0? */
540 beqlr- /* return if len == 0 */
541 addi %r5,%r5,-1 /* len -= 1 */
542 slwi %r5,%r5,2 /* len *= 4 */
543 add %r5,%r5,%r4 /* len += src */
544 addi %r4,%r4,-4 /* pre-decrement */
545 1: lwz %r0,0(%r3) /* load value */
546 stwu %r0,4(%r4) /* store and increment */
547 cmpl 0,%r4,%r5 /* at the end? */
548 bne+ 1b /* nope, do another pass */
549 eieio /* memory barrier (reorder protection) */
550 DBGSYNC /* force exceptions */
553 /* LINTSTUB: Func: void bsrm8_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t *addr, bus_size_t len) */
554 /* LINTSTUB: Func: void bsrm8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t *addr, bus_size_t len) */
559 /* LINTSTUB: Func: void bsrm2rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t *addr, bus_size_t len) */
560 /* LINTSTUB: Func: void ins16rb(const volatile u_int16_t *src, u_int16_t *dst, size_t len) */
563 lwz %r0,0(%r3) /* get log2(stride) */
564 rotlw %r5,%r5,%r0 /* shift offset */
566 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
567 mr %r4,%r6 /* move addr to argument 1 register */
568 mr %r5,%r7 /* move count to argument 2 register */
570 cmpwi %r5,0 /* len == 0? */
571 beqlr- /* return if len == 0 */
572 addi %r5,%r5,-1 /* len -= 1 */
573 slwi %r5,%r5,1 /* len *= 2 */
574 add %r5,%r5,%r4 /* len += src */
575 addi %r4,%r4,-2 /* pre-decrement */
576 1: lhbrx %r0,0,%r3 /* load value (byte reversed) */
577 sthu %r0,2(%r4) /* store and increment */
578 cmpl 0,%r4,%r5 /* at the end? */
579 bne+ 1b /* nope, do another pass */
580 eieio /* memory barrier (reorder protection) */
581 DBGSYNC /* force exceptions */
584 /* LINTSTUB: Func: void bsrm4rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t *addr, bus_size_t len) */
585 /* LINTSTUB: Func: void bsrm4rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t *addr, bus_size_t len) */
586 /* LINTSTUB: Func: void ins32rb(const volatile u_int32_t *src, u_int32_t *dst, size_t len) */
588 lwz %r0,0(%r3) /* get log2(stride) */
589 rotlw %r5,%r5,%r0 /* shift offset */
591 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
592 mr %r4,%r6 /* move addr to argument 1 register */
593 mr %r5,%r7 /* move count to argument 2 register */
595 cmpwi %r5,0 /* len == 0? */
596 beqlr- /* return if len == 0 */
597 addi %r5,%r5,-1 /* len -= 1 */
598 slwi %r5,%r5,2 /* len *= 4 */
599 add %r5,%r5,%r4 /* len += src */
600 addi %r4,%r4,-4 /* pre-decrement */
601 1: lwbrx %r0,0,%r3 /* load value (byte reversed) */
602 stwu %r0,4(%r4) /* store and increment */
603 cmpl 0,%r4,%r5 /* at the end? */
604 bne+ 1b /* nope, do another pass */
605 eieio /* memory barrier (reorder protection) */
606 DBGSYNC /* force exceptions */
609 /* LINTSTUB: Func: void bsrm8rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t *addr, bus_size_t len) */
610 /* LINTSTUB: Func: void bsrm8rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t *addr, bus_size_t len) */
615 /* LINTSTUB: Func: void bswr1_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int8_t *a, bus_size_t c); */
616 /* LINTSTUB: Func: void bswr1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int8_t *a, bus_size_t c); */
618 lwz %r0,0(%r3) /* get log2(stride) */
619 li %r8,1 /* distance between dst bytes */
620 rotlw %r5,%r5,%r0 /* shift offset */
621 rotlw %r8,%r8,%r0 /* shift distance */
624 li %r8,1 /* distance between dst bytes */
626 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
627 cmpwi %r7,0 /* len == 0? */
628 beqlr- /* return if len == 0 */
629 addi %r7,%r7,-1 /* len -= 1 */
630 add %r7,%r7,%r6 /* len += src */
631 addi %r6,%r6,-1 /* pre-decrement */
633 1: lbzu %r0,1(%r6) /* load and increment */
634 stbux %r0,%r3,%r8 /* store and add distance */
635 cmpl 0,%r6,%r7 /* at the end? */
636 bne+ 1b /* nope, do another pass */
637 eieio /* memory barrier (reorder protection) */
638 DBGSYNC /* force exceptions */
641 /* LINTSTUB: Func: void bswr2_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c); */
642 /* LINTSTUB: Func: void bswr2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c); */
644 lwz %r0,0(%r3) /* get log2(stride) */
645 li %r8,2 /* distance between dst halfwords */
646 rotlw %r5,%r5,%r0 /* shift offset */
647 rotlw %r8,%r8,%r0 /* shift distance */
650 li %r8,2 /* distance between dst halfwords */
652 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
653 cmpwi %r7,0 /* len == 0? */
654 beqlr- /* return if len == 0 */
655 addi %r7,%r7,-1 /* len -= 1 */
656 slwi %r7,%r7,1 /* len *= 2 */
657 add %r7,%r7,%r6 /* len += src */
658 addi %r6,%r6,-2 /* pre-decrement */
660 1: lhzu %r0,2(%r6) /* load and increment */
661 sthux %r0,%r3,%r8 /* store and add distance */
662 cmpl 0,%r6,%r7 /* at the end? */
663 bne+ 1b /* nope, do another pass */
664 eieio /* memory barrier (reorder protection) */
665 DBGSYNC /* force exceptions */
668 /* LINTSTUB: Func: void bswr2rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c); */
669 /* LINTSTUB: Func: void bswr2rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c); */
671 lwz %r0,0(%r3) /* get log2(stride) */
672 li %r8,2 /* distance between dst halfwords */
673 rotlw %r5,%r5,%r0 /* shift offset */
674 rotlw %r8,%r8,%r0 /* shift distance */
677 li %r8,2 /* distance between dst halfwords */
679 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
680 cmpwi %r7,0 /* len == 0? */
681 beqlr- /* return if len == 0 */
682 addi %r7,%r7,-1 /* len -= 1 */
683 slwi %r7,%r7,1 /* len *= 2 */
684 add %r7,%r7,%r6 /* len += src */
685 addi %r6,%r6,-2 /* pre-decrement */
686 1: lhzu %r0,2(%r6) /* load and increment */
687 sthbrx %r0,0,%r3 /* store (reversed) */
688 add %r3,%r3,%r8 /* dst += distance */
689 cmpl 0,%r6,%r7 /* at the end? */
690 bne+ 1b /* nope, do another pass */
691 eieio /* memory barrier (reorder protection) */
692 DBGSYNC /* force exceptions */
695 /* LINTSTUB: Func: void bswr4_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c); */
696 /* LINTSTUB: Func: void bswr4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c); */
698 lwz %r0,0(%r3) /* get log2(stride) */
699 li %r8,4 /* distance between dst halfwords */
700 rotlw %r5,%r5,%r0 /* shift offset */
701 rotlw %r8,%r8,%r0 /* shift distance */
704 li %r8,4 /* distance between dst halfwords */
706 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
707 cmpwi %r7,0 /* len == 0? */
708 beqlr- /* return if len == 0 */
709 addi %r7,%r7,-1 /* len -= 1 */
710 slwi %r7,%r7,2 /* len *= 4 */
711 add %r7,%r7,%r6 /* len += src */
712 addi %r6,%r6,-4 /* pre-decrement */
714 1: lwzu %r0,4(%r6) /* load and increment */
715 stwux %r0,%r3,%r8 /* store and add distance */
716 cmpl 0,%r6,%r7 /* at the end? */
717 bne+ 1b /* nope, do another pass */
718 eieio /* memory barrier (reorder protection) */
719 DBGSYNC /* force exceptions */
722 /* LINTSTUB: Func: void bswr4rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c); */
723 /* LINTSTUB: Func: void bswr4rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c); */
725 lwz %r0,0(%r3) /* get log2(stride) */
726 li %r8,4 /* distance between dst halfwords */
727 rotlw %r5,%r5,%r0 /* shift offset */
728 rotlw %r8,%r8,%r0 /* shift distance */
731 li %r8,4 /* distance between dst halfwords */
733 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
734 cmpwi %r7,0 /* len == 0? */
735 beqlr- /* return if len == 0 */
736 addi %r7,%r7,-1 /* len -= 1 */
737 slwi %r7,%r7,2 /* len *= 4 */
738 add %r7,%r7,%r6 /* len += src */
739 addi %r6,%r6,-4 /* pre-decrement */
740 1: lwzu %r0,4(%r6) /* load and increment */
741 stwbrx %r0,0,%r3 /* store (reversed) */
742 add %r3,%r3,%r8 /* dst += distance */
743 cmpl 0,%r6,%r7 /* at the end? */
744 bne+ 1b /* nope, do another pass */
745 eieio /* memory barrier (reorder protection) */
746 DBGSYNC /* force exceptions */
749 /* LINTSTUB: Func: void bswr8_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t *a, bus_size_t c); */
750 /* LINTSTUB: Func: void bswr8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t *a, bus_size_t c); */
751 /* LINTSTUB: Func: void bswr8rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t *a, bus_size_t c); */
752 /* LINTSTUB: Func: void bswr8rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t *a, bus_size_t c); */
761 /* LINTSTUB: Func: void bsrr1_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t *a, bus_size_t c); */
762 /* LINTSTUB: Func: void bsrr1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t *a, bus_size_t c); */
764 lwz %r0,0(%r3) /* get log2(stride) */
765 li %r8,1 /* distance between src bytes */
766 rotlw %r5,%r5,%r0 /* shift offset */
767 rotlw %r8,%r8,%r0 /* shift distance */
770 li %r8,1 /* distance between src bytes */
772 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
773 cmpwi %r7,0 /* len == 0? */
774 beqlr- /* return if len == 0 */
775 addi %r7,%r7,-1 /* len -= 1 */
776 add %r7,%r7,%r6 /* len += src */
777 addi %r6,%r6,-1 /* pre-decrement */
779 1: lbzux %r0,%r3,%r8 /* load value and add distance */
780 stbu %r0,1(%r6) /* store and increment */
781 cmpl 0,%r6,%r7 /* at the end? */
782 bne+ 1b /* nope, do another pass */
783 eieio /* memory barrier (reorder protection) */
784 DBGSYNC /* force exceptions */
787 /* LINTSTUB: Func: void bsrr2_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c); */
788 /* LINTSTUB: Func: void bsrr2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c); */
790 lwz %r0,0(%r3) /* get log2(stride) */
791 li %r8,2 /* distance between src halfwords */
792 rotlw %r5,%r5,%r0 /* shift offset */
793 rotlw %r8,%r8,%r0 /* shift distance */
796 li %r8,2 /* distance between src halfwords */
798 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
799 cmpwi %r7,0 /* len == 0? */
800 beqlr- /* return if len == 0 */
801 addi %r7,%r7,-1 /* len -= 1 */
802 slwi %r7,%r7,1 /* len *= 2 */
803 add %r7,%r7,%r6 /* len += src */
804 addi %r6,%r6,-2 /* pre-decrement */
806 1: lhzux %r0,%r3,%r8 /* load value and add distance */
807 sthu %r0,2(%r6) /* store and increment */
808 cmpl 0,%r6,%r7 /* at the end? */
809 bne+ 1b /* nope, do another pass */
810 eieio /* memory barrier (reorder protection) */
811 DBGSYNC /* force exceptions */
814 /* LINTSTUB: Func: void bsrr2rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c); */
815 /* LINTSTUB: Func: void bsrr2rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c); */
817 lwz %r0,0(%r3) /* get log2(stride) */
818 li %r8,2 /* distance between source halfwords */
819 rotlw %r5,%r5,%r0 /* shift offset */
820 rotlw %r8,%r8,%r0 /* shift distance */
823 li %r8,2 /* distance between source halfwords */
825 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
826 cmpwi %r7,0 /* len == 0? */
827 beqlr- /* return if len == 0 */
828 addi %r7,%r7,-1 /* len -= 1 */
829 slwi %r7,%r7,1 /* len *= 2 */
830 add %r7,%r7,%r6 /* len += src */
831 addi %r6,%r6,-2 /* pre-decrement */
832 1: lhbrx %r0,0,%r3 /* load value (reversed) */
833 add %r3,%r3,%r8 /* src += distance */
834 sthu %r0,2(%r6) /* store and increment */
835 cmpl 0,%r6,%r7 /* at the end? */
836 bne+ 1b /* nope, do another pass */
837 eieio /* memory barrier (reorder protection) */
838 DBGSYNC /* force exceptions */
841 /* LINTSTUB: Func: void bsrr4_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c); */
842 /* LINTSTUB: Func: void bsrr4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c); */
844 lwz %r0,0(%r3) /* get log2(stride) */
845 li %r8,4 /* distance between src words */
846 rotlw %r5,%r5,%r0 /* shift offset */
847 rotlw %r8,%r8,%r0 /* shift distance */
850 li %r8,4 /* distance between src words */
852 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
853 cmpwi %r7,0 /* len == 0? */
854 beqlr- /* return if len == 0 */
855 addi %r7,%r7,-1 /* len -= 1 */
856 slwi %r7,%r7,2 /* len *= 4 */
857 add %r7,%r7,%r6 /* len += src */
858 addi %r6,%r6,-4 /* pre-decrement */
860 1: lwzux %r0,%r3,%r8 /* load value and add distance */
861 stwu %r0,4(%r6) /* store and increment */
862 cmpl 0,%r6,%r7 /* at the end? */
863 bne+ 1b /* nope, do another pass */
864 eieio /* memory barrier (reorder protection) */
865 DBGSYNC /* force exceptions */
868 /* LINTSTUB: Func: void bsrr4rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c); */
869 /* LINTSTUB: Func: void bsrr4rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c); */
871 lwz %r0,0(%r3) /* get log2(stride) */
872 li %r8,4 /* distance between src words */
873 rotlw %r5,%r5,%r0 /* shift offset */
874 rotlw %r8,%r8,%r0 /* shift distance */
877 li %r8,4 /* distance between src words */
879 add %r3,%r4,%r5 /* add offset to handle & place in argument 0 */
880 mr %r4,%r6 /* move addr to argument 1 register */
881 cmpwi %r7,0 /* len == 0? */
882 beqlr- /* return if len == 0 */
883 addi %r7,%r7,-1 /* len -= 1 */
884 slwi %r7,%r7,2 /* len *= 4 */
885 add %r7,%r7,%r6 /* len += src */
886 addi %r6,%r6,-4 /* pre-decrement */
887 1: lwbrx %r0,0,%r3 /* load value (reversed) */
888 add %r3,%r3,%r8 /* src += distance */
889 sthu %r0,4(%r6) /* store and increment */
890 cmpl 0,%r6,%r7 /* at the end? */
891 bne+ 1b /* nope, do another pass */
892 eieio /* memory barrier (reorder protection) */
893 DBGSYNC /* force exceptions */
896 /* LINTSTUB: Func: void bsrr8_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t *a, bus_size_t c); */
897 /* LINTSTUB: Func: void bsrr8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t *a, bus_size_t c); */
898 /* LINTSTUB: Func: void bsrr8rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t *a, bus_size_t c); */
899 /* LINTSTUB: Func: void bsrr8rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t *a, bus_size_t c); */
908 /* LINTSTUB: Func: void bssr1_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t v, bus_size_t c); */
909 /* LINTSTUB: Func: void bssr1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t v, bus_size_t c); */
911 lwz %r0,0(%r3) /* get log2(stride) */
912 li %r8,1 /* distance between src bytes */
913 rotlw %r5,%r5,%r0 /* shift offset */
914 rotlw %r8,%r8,%r0 /* shift distance */
917 li %r8,1 /* distance between src bytes */
919 cmpwi %r7,0 /* len == 0? */
920 beqlr- /* return if len == 0 */
921 1: addi %r7,%r7,-1 /* len -= 1 */
922 stbx %r6,%r4,%r5 /* store value */
923 add %r5,%r5,%r8 /* add offset */
924 cmpwi %r7,0 /* len == 0? */
925 bne+ 1b /* nope, do another pass */
926 eieio /* memory barrier (reorder protection) */
927 DBGSYNC /* force exceptions */
930 /* LINTSTUB: Func: void bssr2_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t v, bus_size_t c); */
931 /* LINTSTUB: Func: void bssr2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t v, bus_size_t c); */
933 lwz %r0,0(%r3) /* get log2(stride) */
934 li %r8,2 /* distance between src halfwords */
935 rotlw %r5,%r5,%r0 /* shift offset */
936 rotlw %r8,%r8,%r0 /* shift distance */
939 li %r8,2 /* distance between src halfwords */
941 cmpwi %r7,0 /* len == 0? */
942 beqlr- /* return if len == 0 */
943 1: addi %r7,%r7,-1 /* len -= 1 */
944 sthx %r6,%r4,%r5 /* store value */
945 add %r5,%r5,%r8 /* add offset */
946 cmpwi %r7,0 /* len == 0? */
947 bne+ 1b /* nope, do another pass */
948 eieio /* memory barrier (reorder protection) */
949 DBGSYNC /* force exceptions */
952 /* LINTSTUB: Func: void bssr2rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t v, bus_size_t c); */
953 /* LINTSTUB: Func: void bssr2rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int16_t v, bus_size_t c); */
955 lwz %r0,0(%r3) /* get log2(stride) */
956 li %r8,2 /* distance between src halfwords */
957 rotlw %r5,%r5,%r0 /* shift offset */
958 rotlw %r8,%r8,%r0 /* shift distance */
961 li %r8,2 /* distance between src halfwords */
963 cmpwi %r7,0 /* len == 0? */
964 beqlr- /* return if len == 0 */
965 1: addi %r7,%r7,-1 /* len -= 1 */
966 sthbrx %r6,%r4,%r5 /* store value */
967 add %r5,%r5,%r8 /* add offset */
968 cmpwi %r7,0 /* len == 0? */
969 bne+ 1b /* nope, do another pass */
970 eieio /* memory barrier (reorder protection) */
971 DBGSYNC /* force exceptions */
974 /* LINTSTUB: Func: void bssr4_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t v, bus_size_t c); */
975 /* LINTSTUB: Func: void bssr4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t v, bus_size_t c); */
977 lwz %r0,0(%r3) /* get log2(stride) */
978 li %r8,4 /* distance between src words */
979 rotlw %r5,%r5,%r0 /* shift offset */
980 rotlw %r8,%r8,%r0 /* shift distance */
983 li %r8,4 /* distance between src words */
985 cmpwi %r7,0 /* len == 0? */
986 beqlr- /* return if len == 0 */
987 1: addi %r7,%r7,-1 /* len -= 1 */
988 stwx %r6,%r4,%r5 /* store value */
989 add %r5,%r5,%r8 /* add offset */
990 cmpwi %r7,0 /* len == 0? */
991 bne+ 1b /* nope, do another pass */
992 eieio /* memory barrier (reorder protection) */
993 DBGSYNC /* force exceptions */
996 /* LINTSTUB: Func: void bssr4rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t v, bus_size_t c); */
997 /* LINTSTUB: Func: void bssr4rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int32_t v, bus_size_t c); */
999 lwz %r0,0(%r3) /* get log2(stride) */
1000 li %r8,4 /* distance between src words */
1001 rotlw %r5,%r5,%r0 /* shift offset */
1002 rotlw %r8,%r8,%r0 /* shift distance */
1005 li %r8,4 /* distance between src words */
1007 cmpwi %r7,0 /* len == 0? */
1008 beqlr- /* return if len == 0 */
1009 1: addi %r7,%r7,-1 /* len -= 1 */
1010 stwbrx %r6,%r4,%r5 /* store value */
1011 add %r5,%r5,%r8 /* add offset */
1012 cmpwi %r7,0 /* len == 0? */
1013 bne+ 1b /* nope, do another pass */
1014 eieio /* memory barrier (reorder protection) */
1015 DBGSYNC /* force exceptions */
1018 /* LINTSTUB: Func: void bssr8_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t v, bus_size_t c); */
1019 /* LINTSTUB: Func: void bssr8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t v, bus_size_t c); */
1020 /* LINTSTUB: Func: void bssr8rb_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t v, bus_size_t c); */
1021 /* LINTSTUB: Func: void bssr8rb(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, const u_int64_t v, bus_size_t c); */
1030 /* LINTSTUB: Func: void bscr1_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, bus_space_handle_t h2, bus_size_t o2, bus_size_t len); */
1031 /* LINTSTUB: Func: void bscr1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, bus_space_handle_t h2, bus_size_t o2, bus_size_t len); */
1033 lwz %r0,0(%r3) /* get log2(stride) */
1036 li %r0,0 /* non stride */
1038 li %r9,1 /* distance between src bytes */
1039 rotlw %r9,%r9,%r0 /* shift distance */
1040 cmpwi %r8,0 /* len == 0? */
1041 beqlr- /* return if len == 0 */
1042 rotlw %r5,%r5,%r0 /* shift src offset */
1043 rotlw %r7,%r7,%r0 /* shift dest offset */
1044 add %r10,%r4,%r5 /* calculate src end address */
1045 add %r11,%r6,%r7 /* calculate dest end address */
1047 cmpw %r10,%r11 /* compare end address */
1048 blt 2f /* jump if h + o < h2 + o2 */
1050 /* h + o >= h2 + o2 */
1051 1: lbzx %r12,%r4,%r5 /* load value */
1052 stbx %r12,%r6,%r7 /* store value */
1053 add %r5,%r5,%r9 /* src offset += 1 */
1054 add %r7,%r7,%r9 /* dest offset += 1 */
1055 bdnz+ 1b /* jump if len != 0 */
1056 b .Lbscr1_end /* end */
1058 /* h + o < h2 + o2 */
1059 2: addi %r8,%r8,-1 /* len -= 1 */
1060 rotlw %r8,%r8,%r0 /* shift len */
1061 add %r5,%r10,%r8 /* src offset = o + len - 1 */
1062 add %r7,%r11,%r8 /* dest offset = o2 + len - 1 */
1063 3: lbzx %r12,%r4,%r5 /* load value */
1064 stbx %r12,%r6,%r7 /* store value */
1065 sub %r5,%r5,%r9 /* src offset -= 1 */
1066 sub %r7,%r7,%r9 /* dest offset -= 1 */
1067 bdnz+ 3b /* jump if len != 0 */
1069 eieio /* memory barrier (reorder protection) */
1070 DBGSYNC /* force exceptions */
1073 /* LINTSTUB: Func: void bscr2_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, bus_space_handle_t h2, bus_size_t o2, bus_size_t len); */
1074 /* LINTSTUB: Func: void bscr2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, bus_space_handle_t h2, bus_size_t o2, bus_size_t len); */
1076 lwz %r0,0(%r3) /* get log2(stride) */
1079 li %r0,0 /* non stride */
1081 li %r9,2 /* distance between src halfwords */
1082 rotlw %r9,%r9,%r0 /* shift distance */
1083 cmpwi %r8,0 /* len == 0? */
1084 beqlr- /* return if len == 0 */
1085 rotlw %r5,%r5,%r0 /* shift src offset */
1086 rotlw %r7,%r7,%r0 /* shift dest offset */
1087 add %r10,%r4,%r5 /* calculate src end address */
1088 add %r11,%r6,%r7 /* calculate dest end address */
1090 cmpw %r10,%r11 /* compare end address */
1091 blt 2f /* jump if h + o < h2 + o2 */
1093 /* h + o >= h2 + o2 */
1094 1: lhzx %r12,%r4,%r5 /* load value */
1095 sthx %r12,%r6,%r7 /* store value */
1096 add %r5,%r5,%r9 /* src offset += 2 */
1097 add %r7,%r7,%r9 /* dest offset += 2 */
1098 bdnz+ 1b /* jump if len != 0 */
1099 b .Lbscr2_end /* end */
1101 /* h + o < h2 + o2 */
1102 2: addi %r8,%r8,-1 /* len -= 1 */
1103 rotlw %r8,%r8,%r0 /* shift len */
1104 add %r5,%r10,%r8 /* src offset = o + len - 1 */
1105 add %r7,%r11,%r8 /* dest offset = o2 + len - 1 */
1106 3: lhzx %r12,%r4,%r5 /* load value */
1107 sthx %r12,%r6,%r7 /* store value */
1108 sub %r5,%r5,%r9 /* src offset -= 2 */
1109 sub %r7,%r7,%r9 /* dest offset -= 2 */
1110 bdnz+ 3b /* jump if len != 0 */
1112 eieio /* memory barrier (reorder protection) */
1113 DBGSYNC /* force exceptions */
1116 /* LINTSTUB: Func: void bscr4_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, bus_space_handle_t h2, bus_size_t o2, bus_size_t len); */
1117 /* LINTSTUB: Func: void bscr4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, bus_space_handle_t h2, bus_size_t o2, bus_size_t len); */
1119 lwz %r0,0(%r3) /* get log2(stride) */
1122 li %r0,0 /* non stride */
1124 li %r9,4 /* distance between src words */
1125 rotlw %r9,%r9,%r0 /* shift distance */
1126 cmpwi %r8,0 /* len == 0? */
1127 beqlr- /* return if len == 0 */
1128 rotlw %r5,%r5,%r0 /* shift src offset */
1129 rotlw %r7,%r7,%r0 /* shift dest offset */
1130 add %r10,%r4,%r5 /* calculate src end address */
1131 add %r11,%r6,%r7 /* calculate dest end address */
1133 cmpw %r10,%r11 /* compare end address */
1134 blt 2f /* jump if h + o < h2 + o2 */
1136 /* h + o >= h2 + o2 */
1137 1: lwzx %r12,%r4,%r5 /* load value */
1138 stwx %r12,%r6,%r7 /* store value */
1139 add %r5,%r5,%r9 /* src offset += 4 */
1140 add %r7,%r7,%r9 /* dest offset += 4 */
1141 bdnz+ 1b /* jump if len != 0 */
1142 b .Lbscr4_end /* end */
1144 /* h + o < h2 + o2 */
1145 2: addi %r8,%r8,-1 /* len -= 1 */
1146 rotlw %r8,%r8,%r0 /* shift len */
1147 add %r5,%r10,%r8 /* src offset = o + len - 1 */
1148 add %r7,%r11,%r8 /* dest offset = o2 + len - 1 */
1149 3: lwzx %r12,%r4,%r5 /* load value */
1150 stwx %r12,%r6,%r7 /* store value */
1151 sub %r5,%r5,%r9 /* src offset -= 4 */
1152 sub %r7,%r7,%r9 /* dest offset -= 4 */
1153 bdnz+ 3b /* jump if len != 0 */
1155 eieio /* memory barrier (reorder protection) */
1156 DBGSYNC /* force exceptions */
1159 /* LINTSTUB: Func: void bscr8_s(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, bus_space_handle_t h2, bus_size_t o2, bus_size_t len); */
1160 /* LINTSTUB: Func: void bscr8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, bus_space_handle_t h2, bus_size_t o2, bus_size_t len); */