Changeset 544615d in rtems


Ignore:
Timestamp:
May 2, 2013, 3:41:11 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
037e8ae5
Parents:
d2d02961
git-author:
Sebastian Huber <sebastian.huber@…> (05/02/13 15:41:11)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/03/13 15:30:55)
Message:

bsps/arm: Add arm_cp15_mmu_disable()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/arm/shared/include/arm-cp15.h

    rd2d02961 r544615d  
    173173 */
    174174
     175/**
     176 * @brief Disable the MMU.
     177 *
     178 * This function will clean and invalidate eight cache lines before and after
     179 * the current stack pointer.
     180 *
     181 * @param[in] cls The data cache line size.
     182 *
     183 * @return The current control register value.
     184 */
     185static inline uint32_t arm_cp15_mmu_disable(uint32_t cls)
     186{
     187  ARM_SWITCH_REGISTERS;
     188  uint32_t ctrl;
     189  uint32_t tmp_0;
     190  uint32_t tmp_1;
     191
     192  __asm__ volatile (
     193    ARM_SWITCH_TO_ARM
     194    "mrc p15, 0, %[ctrl], c1, c0, 0\n"
     195    "bic %[tmp_0], %[ctrl], #1\n"
     196    "mcr p15, 0, %[tmp_0], c1, c0, 0\n"
     197    "nop\n"
     198    "nop\n"
     199    "mov %[tmp_1], sp\n"
     200    "rsb %[tmp_0], %[cls], #0\n"
     201    "and %[tmp_0], %[tmp_0], %[tmp_1]\n"
     202    "sub %[tmp_0], %[tmp_0], %[cls], asl #3\n"
     203    "add %[tmp_1], %[tmp_0], %[cls], asl #4\n"
     204    "1:\n"
     205    "mcr p15, 0, %[tmp_0], c7, c14, 1\n"
     206    "add %[tmp_0], %[tmp_0], %[cls]\n"
     207    "cmp %[tmp_1], %[tmp_0]\n"
     208    "bne 1b\n"
     209    ARM_SWITCH_BACK
     210    : [ctrl] "=&r" (ctrl),
     211      [tmp_0] "=&r" (tmp_0),
     212      [tmp_1] "=&r" (tmp_1)
     213      ARM_SWITCH_ADDITIONAL_OUTPUT
     214    : [cls] "r" (cls)
     215    : "memory", "cc"
     216  );
     217
     218  return ctrl;
     219}
     220
    175221static inline uint32_t *arm_cp15_get_translation_table_base(void)
    176222{
Note: See TracChangeset for help on using the changeset viewer.