Home | History | Annotate | Line # | Download | only in vfp
pmap_vfp.S revision 1.6.6.2
      1  1.6.6.2  tls /*-
      2  1.6.6.2  tls  * Copyright (c) 2012 The NetBSD Foundation, Inc.
      3  1.6.6.2  tls  * All rights reserved.
      4  1.6.6.2  tls  *
      5  1.6.6.2  tls  * This code is derived from software contributed to The NetBSD Foundation
      6  1.6.6.2  tls  * by Matt Thomas of 3am Software Foundry.
      7  1.6.6.2  tls  *
      8  1.6.6.2  tls  * Redistribution and use in source and binary forms, with or without
      9  1.6.6.2  tls  * modification, are permitted provided that the following conditions
     10  1.6.6.2  tls  * are met:
     11  1.6.6.2  tls  * 1. Redistributions of source code must retain the above copyright
     12  1.6.6.2  tls  *    notice, this list of conditions and the following disclaimer.
     13  1.6.6.2  tls  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.6.6.2  tls  *    notice, this list of conditions and the following disclaimer in the
     15  1.6.6.2  tls  *    documentation and/or other materials provided with the distribution.
     16  1.6.6.2  tls  *
     17  1.6.6.2  tls  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18  1.6.6.2  tls  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19  1.6.6.2  tls  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  1.6.6.2  tls  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21  1.6.6.2  tls  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  1.6.6.2  tls  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  1.6.6.2  tls  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  1.6.6.2  tls  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  1.6.6.2  tls  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  1.6.6.2  tls  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27  1.6.6.2  tls  * POSSIBILITY OF SUCH DAMAGE.
     28  1.6.6.2  tls  */
     29  1.6.6.2  tls 
     30  1.6.6.2  tls #include "opt_cputypes.h"
     31  1.6.6.2  tls 
     32  1.6.6.2  tls #include <machine/asm.h>
     33  1.6.6.2  tls #include "assym.h"
     34  1.6.6.2  tls 
     35  1.6.6.2  tls RCSID("$NetBSD: pmap_vfp.S,v 1.6.6.2 2013/02/25 00:28:32 tls Exp $")
     36  1.6.6.2  tls 
     37  1.6.6.2  tls /*
     38  1.6.6.2  tls  * This zeroes a page 64-bytes at a time.  64 was chosen over 32 since
     39  1.6.6.2  tls  * 64 is the cache line size of the Cortex-A8.
     40  1.6.6.2  tls  */
     41  1.6.6.2  tls /* LINTSTUB: void bzero_page_vfp(vaddr_t); */
     42  1.6.6.2  tls ENTRY(bzero_page_vfp)
     43  1.6.6.2  tls 	push	{r0, lr}
     44  1.6.6.2  tls 	bl	_C_LABEL(vfp_kernel_acquire)
     45  1.6.6.2  tls 	pop	{r0, lr}
     46  1.6.6.2  tls #if (CPU_CORTEX == 0)
     47  1.6.6.2  tls 	mov	ip, #0
     48  1.6.6.2  tls 	vmov	s0, ip
     49  1.6.6.2  tls 	vmov	s1, ip
     50  1.6.6.2  tls 	vmov.f64 d1, d0
     51  1.6.6.2  tls 	vmov.f64 d2, d0
     52  1.6.6.2  tls 	vmov.f64 d3, d0
     53  1.6.6.2  tls 	vmov.f64 d4, d0
     54  1.6.6.2  tls 	vmov.f64 d5, d0
     55  1.6.6.2  tls 	vmov.f64 d6, d0
     56  1.6.6.2  tls 	vmov.f64 d7, d0
     57  1.6.6.2  tls #else
     58  1.6.6.2  tls 	veor	q0, q0, q0
     59  1.6.6.2  tls 	veor	q1, q1, q1
     60  1.6.6.2  tls 	veor	q2, q2, q2
     61  1.6.6.2  tls 	veor	q3, q3, q3
     62  1.6.6.2  tls #endif
     63  1.6.6.2  tls 	add	r2, r0, #PAGE_SIZE
     64  1.6.6.2  tls 1:	vstmia	r0!, {d0-d7}
     65  1.6.6.2  tls 	vstmia	r0!, {d0-d7}
     66  1.6.6.2  tls 	vstmia	r0!, {d0-d7}
     67  1.6.6.2  tls 	vstmia	r0!, {d0-d7}
     68  1.6.6.2  tls 	cmp	r0, r2
     69  1.6.6.2  tls 	blt	1b
     70  1.6.6.2  tls 	b	_C_LABEL(vfp_kernel_release)	/* tailcall the vfp release */
     71  1.6.6.2  tls END(bzero_page_vfp)
     72  1.6.6.2  tls 
     73  1.6.6.2  tls /*
     74  1.6.6.2  tls  * This copies a page 64-bytes at a time.  64 was chosen over 32 since
     75  1.6.6.2  tls  * 64 is the cache line size of the Cortex-A8.
     76  1.6.6.2  tls  */
     77  1.6.6.2  tls /* LINTSTUB: void bcopy_page_vfp(vaddr_t, vaddr_t); */
     78  1.6.6.2  tls ENTRY(bcopy_page_vfp)
     79  1.6.6.2  tls #ifdef _ARM_ARCH_DWORD_OK
     80  1.6.6.2  tls 	pld	[r0]			@ preload the first 128 bytes
     81  1.6.6.2  tls 	pld	[r0, #32]
     82  1.6.6.2  tls 	pld	[r0, #64]
     83  1.6.6.2  tls 	pld	[r0, #96]
     84  1.6.6.2  tls #endif
     85  1.6.6.2  tls 	str	lr, [sp, #-8]!
     86  1.6.6.2  tls 	push	{r0, r1}
     87  1.6.6.2  tls 	bl	_C_LABEL(vfp_kernel_acquire)
     88  1.6.6.2  tls 	pop	{r0, r1}
     89  1.6.6.2  tls 	ldr	lr, [sp], #8		/* fetch LR */
     90  1.6.6.2  tls 	add	r2, r0, #PAGE_SIZE-128
     91  1.6.6.2  tls 1:
     92  1.6.6.2  tls #ifdef _ARM_ARCH_DWORD_OK
     93  1.6.6.2  tls 	pld	[r0, #128]		@ preload the next 128
     94  1.6.6.2  tls 	pld	[r0, #160]
     95  1.6.6.2  tls 	pld	[r0, #192]
     96  1.6.6.2  tls 	pld	[r0, #224]
     97  1.6.6.2  tls #endif
     98  1.6.6.2  tls 2:	vldmia	r0!, {d0-d7}		@ read   0-63
     99  1.6.6.2  tls 	vstmia	r1!, {d0-d7}		@ write  0-63
    100  1.6.6.2  tls 	vldmia	r0!, {d0-d7}		@ read  64-127
    101  1.6.6.2  tls 	vstmia	r1!, {d0-d7}		@ write 64-127
    102  1.6.6.2  tls 	cmp	r0, r2
    103  1.6.6.2  tls 	blt	1b
    104  1.6.6.2  tls 	beq	2b
    105  1.6.6.2  tls 	b	_C_LABEL(vfp_kernel_release)	/* tailcall the vfp release */
    106  1.6.6.2  tls END(bcopy_page_vfp)
    107