Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/barrier.h

    r2a8f38a r7dc8bf1  
    3939/*
    4040 * TODO: implement true ARM memory barriers for macros below.
     41 * ARMv6 introduced user access of the following commands:
     42 * • Prefetch flush
     43 * • Data synchronization barrier
     44 * • Data memory barrier
     45 * • Clean and prefetch range operations.
     46 * ARM Architecture Reference Manual version I ch. B.3.2.1 p. B3-4
    4147 */
    4248#define CS_ENTER_BARRIER()  asm volatile ("" ::: "memory")
     
    5460#define read_barrier()    asm volatile ("dsb" ::: "memory")
    5561#define write_barrier()   asm volatile ("dsb st" ::: "memory")
    56 #elif defined PROCESSOR_ARCH_armv6
    57 /* ARMv6- use system control coprocessor (CP15) for memory barrier instructions.
    58  * Although at least mcr p15, 0, r0, c7, c10, 4 is mentioned in earlier archs,
    59  * CP15 implementation is mandatory only for armv6+.
    60  */
    61 #define memory_barrier()  asm volatile ("ldr r0, =0\nmcr p15, 0, r0, c7, c10, 5" ::: "r0", "memory")
    62 #define read_barrier()    asm volatile ("ldr r0, =0\nmcr p15, 0, r0, c7, c10, 4" ::: "r0", "memory")
    63 #define write_barrier()   read_barrier()
    6462#else
    65 /* Older manuals mention syscalls as a way to implement cache coherency and
    66  * barriers. See for example ARM Architecture Reference Manual Version D
    67  * chapter 2.7.4 Prefetching and self-modifying code (p. A2-28)
    68  */
    69 // TODO implement on per PROCESSOR basis
    7063#define memory_barrier()  asm volatile ("" ::: "memory")
    7164#define read_barrier()    asm volatile ("" ::: "memory")
    7265#define write_barrier()   asm volatile ("" ::: "memory")
    7366#endif
    74 
    7567/*
    7668 * There are multiple ways ICache can be implemented on ARM machines. Namely
     
    8880 */
    8981
    90 /* Available on both all supported arms,
     82#ifdef PROCESSOR_ARCH_armv7_a
     83#define smc_coherence(a) asm volatile ( "isb" ::: "memory")
     84#define smc_coherence_block(a, l) smc_coherence(a)
     85#else
     86/* Available on all supported arms,
    9187 * invalidates entire ICache so the written value does not matter. */
     88//TODO might be PL1 only on armv5 -
    9289#define smc_coherence(a) asm volatile ( "mcr p15, 0, r0, c7, c5, 0")
    9390#define smc_coherence_block(a, l) smc_coherence(a)
     91#endif
    9492
    9593
Note: See TracChangeset for help on using the changeset viewer.