Subversion Repositories HelenOS

Rev

Rev 3022 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 40... Line 40...
40
 
40
 
41
#define memory_barrier() asm volatile ("sync" ::: "memory")
41
#define memory_barrier() asm volatile ("sync" ::: "memory")
42
#define read_barrier() asm volatile ("sync" ::: "memory")
42
#define read_barrier() asm volatile ("sync" ::: "memory")
43
#define write_barrier() asm volatile ("eieio" ::: "memory")
43
#define write_barrier() asm volatile ("eieio" ::: "memory")
44
 
44
 
-
 
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
 
-
 
52
static inline void smc_coherence(void *addr)
-
 
53
{
-
 
54
    asm volatile (
-
 
55
        "dcbst 0, %0\n"
-
 
56
        "sync\n"
-
 
57
        "icbi 0, %0\n"
-
 
58
        "sync\n"
-
 
59
        "isync\n"
-
 
60
        :: "r" (addr)
-
 
61
    );
-
 
62
}
-
 
63
 
-
 
64
#define COHERENCE_INVAL_MIN 4
-
 
65
 
-
 
66
static inline void smc_coherence_block(void *addr, unsigned long len)
-
 
67
{
-
 
68
    unsigned long i;
-
 
69
 
-
 
70
    for (i = 0; i < len; i += COHERENCE_INVAL_MIN) {
-
 
71
        asm volatile ("dcbst 0, %0\n" :: "r" (addr + i));
-
 
72
    }
-
 
73
 
-
 
74
    asm volatile ("sync");
-
 
75
 
-
 
76
    for (i = 0; i < len; i += COHERENCE_INVAL_MIN) {
-
 
77
        asm volatile ("icbi 0, %0\n" :: "r" (addr + i));
-
 
78
    }
-
 
79
 
-
 
80
    asm volatile (
-
 
81
        "sync\n"
-
 
82
        "isync\n"
-
 
83
    );
-
 
84
}
-
 
85
 
45
#endif
86
#endif
46
 
87
 
47
/** @}
88
/** @}
48
 */
89
 */