The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/arm/arm/cpufunc_asm_arm9.S

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: cpufunc_asm_arm9.S,v 1.2 2002/01/29 15:27:29 rearnsha Exp $    */
    2 
    3 /*-
    4  * Copyright (c) 2001 ARM Limited
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. The name of the company may not be used to endorse or promote
   16  *    products derived from this software without specific prior written
   17  *    permission.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
   20  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   22  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   23  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  *
   31  * ARM9 assembly functions for CPU / MMU / TLB specific operations
   32  *
   33  */
   34  
   35 #include <machine/asm.h>
   36 __FBSDID("$FreeBSD: releng/6.0/sys/arm/arm/cpufunc_asm_arm9.S 139735 2005-01-05 21:58:49Z imp $");
   37 
   38 /*
   39  * Functions to set the MMU Translation Table Base register
   40  *
   41  * We need to clean and flush the cache as it uses virtual
   42  * addresses that are about to change.
   43  */
   44 ENTRY(arm9_setttb)
   45         /*
   46          * Since we use the caches in write-through mode, we only have to
   47          * drain the write buffers and flush the caches.
   48          */
   49         mcr     p15, 0, r0, c7, c7, 0   /* flush I+D caches */
   50         mcr     p15, 0, r0, c7, c10, 4  /* drain write buffer */
   51 
   52         mcr     p15, 0, r0, c2, c0, 0   /* load new TTB */
   53 
   54         mcr     p15, 0, r0, c8, c7, 0   /* invalidate I+D TLBs */
   55         RET
   56 
   57 /*
   58  * TLB functions
   59  */
   60 ENTRY(arm9_tlb_flushID_SE)
   61         mcr     p15, 0, r0, c8, c6, 1   /* flush D tlb single entry */
   62         mcr     p15, 0, r0, c8, c5, 1   /* flush I tlb single entry */
   63         RET
   64 
   65 /*
   66  * Cache functions
   67  */
   68 ENTRY(arm9_cache_flushID)
   69         mcr     p15, 0, r0, c7, c7, 0   /* flush I+D cache */
   70         RET
   71 
   72 ENTRY(arm9_cache_flushID_SE)
   73         mcr     p15, 0, r0, c7, c5, 1   /* flush one entry from I cache */
   74         mcr     p15, 0, r0, c7, c6, 1   /* flush one entry from D cache */
   75         RET
   76 
   77 ENTRY(arm9_cache_flushI)
   78         mcr     p15, 0, r0, c7, c5, 0   /* flush I cache */
   79         RET
   80 
   81 ENTRY(arm9_cache_flushI_SE)
   82         mcr     p15, 0, r0, c7, c5, 1   /* flush one entry from I cache */
   83         RET
   84 
   85 ENTRY(arm9_cache_flushD)
   86         mcr     p15, 0, r0, c7, c6, 0   /* flush D cache */
   87         RET
   88 
   89 ENTRY(arm9_cache_flushD_SE)
   90         mcr     p15, 0, r0, c7, c6, 1   /* flush one entry from D cache */
   91         RET
   92 
   93 ENTRY(arm9_cache_cleanID)
   94         mcr     p15, 0, r0, c7, c10, 4
   95         RET
   96 
   97 /*
   98  * Soft functions
   99  */
  100 ENTRY(arm9_cache_syncI) 
  101         mcr     p15, 0, r0, c7, c7, 0   /* flush I+D caches */
  102         RET
  103 
  104 ENTRY_NP(arm9_cache_flushID_rng)
  105         b       _C_LABEL(arm9_cache_flushID)
  106 
  107 ENTRY_NP(arm9_cache_flushD_rng)
  108         /* Same as above, but D cache only */
  109         b       _C_LABEL(arm9_cache_flushD)
  110 
  111 ENTRY_NP(arm9_cache_syncI_rng)
  112         /* Similarly, for I cache sync  */
  113         b        _C_LABEL(arm9_cache_syncI)
  114 
  115 /*
  116  * Context switch.
  117  *
  118  * These is the CPU-specific parts of the context switcher cpu_switch()
  119  * These functions actually perform the TTB reload.
  120  *
  121  * NOTE: Special calling convention
  122  *      r1, r4-r13 must be preserved
  123  */
  124 ENTRY(arm9_context_switch)
  125         /*
  126          * We can assume that the caches will only contain kernel addresses
  127          * at this point.  So no need to flush them again.
  128          */
  129         mcr     p15, 0, r0, c7, c10, 4  /* drain the write buffer */
  130         mcr     p15, 0, r0, c2, c0, 0   /* set the new TTB */
  131         mcr     p15, 0, r0, c8, c7, 0   /* and flush the I+D tlbs */
  132 
  133         /* Paranoia -- make sure the pipeline is empty. */
  134         nop
  135         nop
  136         nop
  137         RET

Cache object: 37b8b9765f6ba9775293c7b160036c79


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.