Home | History | Annotate | Line # | Download | only in arm32
bcopy_page.S revision 1.1.6.1
      1  1.1.6.1  thorpej /*	$NetBSD: bcopy_page.S,v 1.1.6.1 2001/08/25 06:15:08 thorpej Exp $	*/
      2      1.1     matt 
      3      1.1     matt /*
      4      1.1     matt  * Copyright (c) 1995 Scott Stevens
      5      1.1     matt  * All rights reserved.
      6      1.1     matt  *
      7      1.1     matt  * Redistribution and use in source and binary forms, with or without
      8      1.1     matt  * modification, are permitted provided that the following conditions
      9      1.1     matt  * are met:
     10      1.1     matt  * 1. Redistributions of source code must retain the above copyright
     11      1.1     matt  *    notice, this list of conditions and the following disclaimer.
     12      1.1     matt  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1     matt  *    notice, this list of conditions and the following disclaimer in the
     14      1.1     matt  *    documentation and/or other materials provided with the distribution.
     15      1.1     matt  * 3. All advertising materials mentioning features or use of this software
     16      1.1     matt  *    must display the following acknowledgement:
     17      1.1     matt  *	This product includes software developed by Scott Stevens.
     18      1.1     matt  * 4. The name of the author may not be used to endorse or promote products
     19      1.1     matt  *    derived from this software without specific prior written permission.
     20      1.1     matt  *
     21      1.1     matt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22      1.1     matt  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23      1.1     matt  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24      1.1     matt  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25      1.1     matt  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26      1.1     matt  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27      1.1     matt  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28      1.1     matt  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29      1.1     matt  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30      1.1     matt  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31      1.1     matt  *
     32      1.1     matt  * RiscBSD kernel project
     33      1.1     matt  *
     34      1.1     matt  * bcopy_page.S
     35      1.1     matt  *
     36      1.1     matt  * page optimised bcopy and bzero routines
     37      1.1     matt  *
     38      1.1     matt  * Created      : 08/04/95
     39      1.1     matt  */
     40      1.1     matt 
     41      1.1     matt #include <machine/param.h>
     42      1.1     matt #include <machine/asm.h>
     43      1.1     matt 
     44  1.1.6.1  thorpej /* #define BIG_LOOPS */
     45  1.1.6.1  thorpej 
     46      1.1     matt /*
     47      1.1     matt  * bcopy_page(src, dest)
     48      1.1     matt  *
     49      1.1     matt  * Optimised copy page routine.
     50      1.1     matt  *
     51      1.1     matt  * On entry:
     52      1.1     matt  *   r0 - src address
     53      1.1     matt  *   r1 - dest address
     54      1.1     matt  *
     55      1.1     matt  * Requires:
     56  1.1.6.1  thorpej  *   number of bytes per page (NBPG) is a multiple of 512 (BIG_LOOPS), 128
     57  1.1.6.1  thorpej  *   otherwise.
     58      1.1     matt  */
     59      1.1     matt 
     60      1.1     matt ENTRY(bcopy_page)
     61  1.1.6.1  thorpej 	stmfd	sp!, {r4-r8, lr}
     62  1.1.6.1  thorpej #ifdef BIG_LOOPS
     63      1.1     matt 	mov	r2, #(NBPG >> 9)
     64  1.1.6.1  thorpej #else
     65  1.1.6.1  thorpej 	mov	r2, #(NBPG >> 7)
     66  1.1.6.1  thorpej #endif
     67      1.1     matt 
     68      1.1     matt Lloopcopy:
     69  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     70  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     71  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     72  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     73  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     74  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     75  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     76  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     77  1.1.6.1  thorpej 
     78  1.1.6.1  thorpej #ifdef BIG_LOOPS
     79  1.1.6.1  thorpej 	/* There is little point making the loop any larger; unless we are
     80  1.1.6.1  thorpej 	   running with the cache off, the load/store overheads will
     81  1.1.6.1  thorpej 	   completely dominate this loop.  */
     82  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     83  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     84  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     85  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     86  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     87  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     88  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     89  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     90  1.1.6.1  thorpej 
     91  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     92  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     93  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     94  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     95  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     96  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     97  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
     98  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
     99  1.1.6.1  thorpej 
    100  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
    101  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
    102  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
    103  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
    104  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
    105  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
    106  1.1.6.1  thorpej 	ldmia	r0!, {r3-r8,ip,lr}
    107  1.1.6.1  thorpej 	stmia	r1!, {r3-r8,ip,lr}
    108  1.1.6.1  thorpej #endif
    109      1.1     matt 	subs	r2, r2, #1
    110      1.1     matt 	bne	Lloopcopy
    111      1.1     matt 
    112  1.1.6.1  thorpej 	ldmfd	sp!, {r4-r8, pc}
    113      1.1     matt 
    114      1.1     matt /*
    115      1.1     matt  * bzero_page(dest)
    116      1.1     matt  *
    117      1.1     matt  * Optimised zero page routine.
    118      1.1     matt  *
    119      1.1     matt  * On entry:
    120      1.1     matt  *   r0 - dest address
    121      1.1     matt  *
    122      1.1     matt  * Requires:
    123  1.1.6.1  thorpej  *   number of bytes per page (NBPG) is a multiple of 512 (BIG_LOOPS), 128
    124  1.1.6.1  thorpej  *   otherwise
    125      1.1     matt  */
    126      1.1     matt 
    127      1.1     matt ENTRY(bzero_page)
    128  1.1.6.1  thorpej 	stmfd	sp!, {r4-r8, lr}
    129  1.1.6.1  thorpej #ifdef BIG_LOOPS
    130      1.1     matt 	mov	r2, #(NBPG >> 9)
    131  1.1.6.1  thorpej #else
    132  1.1.6.1  thorpej 	mov	r2, #(NBPG >> 7)
    133  1.1.6.1  thorpej #endif
    134      1.1     matt 	mov	r3, #0
    135      1.1     matt 	mov	r4, #0
    136      1.1     matt 	mov	r5, #0
    137      1.1     matt 	mov	r6, #0
    138      1.1     matt 	mov	r7, #0
    139      1.1     matt 	mov	r8, #0
    140  1.1.6.1  thorpej 	mov	ip, #0
    141  1.1.6.1  thorpej 	mov	lr, #0
    142      1.1     matt 
    143      1.1     matt Lloopzero:
    144  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    145  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    146  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    147  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    148  1.1.6.1  thorpej 
    149  1.1.6.1  thorpej #ifdef BIG_LOOPS
    150  1.1.6.1  thorpej 	/* There is little point making the loop any larger; unless we are
    151  1.1.6.1  thorpej 	   running with the cache off, the load/store overheads will
    152  1.1.6.1  thorpej 	   completely dominate this loop.  */
    153  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    154  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    155  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    156  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    157  1.1.6.1  thorpej 
    158  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    159  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    160  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    161  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    162  1.1.6.1  thorpej 
    163  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    164  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    165  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    166  1.1.6.1  thorpej 	stmia	r0!, {r3-r8,ip,lr}
    167  1.1.6.1  thorpej 
    168  1.1.6.1  thorpej #endif
    169      1.1     matt 
    170      1.1     matt 	subs	r2, r2, #1
    171      1.1     matt 	bne	Lloopzero
    172      1.1     matt 
    173  1.1.6.1  thorpej 	ldmfd	sp!, {r4-r8, pc}
    174