Changeset 3759681 in mainline


Ignore:
Timestamp:
2008-06-14T16:26:14Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0af4f9e
Parents:
62cd66f
Message:

Implement smc_coherence[_block]() for ppc32

Location:
kernel
Files:
2 edited

Legend:

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

    r62cd66f r3759681  
    4343#define write_barrier() asm volatile ("eieio" ::: "memory")
    4444
    45 #define smc_coherence(a)
    46 #define smc_coherence_block(a, l)
     45/*
     46 * The IMB sequence used here is valid for all possible cache models
     47 * on uniprocessor. SMP might require a different sequence.
     48 * See PowerPC Programming Environment for 32-Bit Microprocessors,
     49 * chapter 5.1.5.2
     50 */
     51
     52static inline void smc_coherence(void *addr)
     53{
     54        asm volatile (
     55                "dcbst 0, %0\n"
     56                "sync\n"
     57                "icbi 0, %0\n"
     58                "isync\n"
     59                :: "r" (addr)
     60        );
     61}
     62
     63#define COHERENCE_INVAL_MIN     4
     64
     65static inline void smc_coherence_block(void *addr, unsigned long len)
     66{
     67        unsigned long i;
     68
     69        for (i = 0; i < len; i += COHERENCE_INVAL_MIN) {
     70                asm volatile ("dcbst 0, %0\n" :: "r" (addr + i));
     71        }
     72
     73        asm volatile ("sync");
     74
     75        for (i = 0; i < len; i += COHERENCE_INVAL_MIN) {
     76                asm volatile ("icbi 0, %0\n" :: "r" (addr + i));
     77        }
     78
     79        asm volatile ("isync");
     80}
    4781
    4882#endif
  • kernel/generic/src/mm/backend_elf.c

    r62cd66f r3759681  
    154154                            (void *) (base + i * FRAME_SIZE), FRAME_SIZE);
    155155                        if (entry->p_flags & PF_X) {
    156                                 smc_coherence_block(PA2KA(frame), FRAME_SIZE);
     156                                smc_coherence_block((void *) PA2KA(frame),
     157                                    FRAME_SIZE);
    157158                        }
    158159                        dirty = true;
     
    194195                    FRAME_SIZE - pad_lo - pad_hi);
    195196                if (entry->p_flags & PF_X) {
    196                         smc_coherence_block(PA2KA(frame) + pad_lo, FRAME_SIZE -
    197                             pad_lo - pad_hi);
     197                        smc_coherence_block((void *) (PA2KA(frame) + pad_lo),
     198                            FRAME_SIZE - pad_lo - pad_hi);
    198199                }
    199200                memsetb((void *) PA2KA(frame), pad_lo, 0);
Note: See TracChangeset for help on using the changeset viewer.