This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Extended asm alternative for Arm Compiler 5 (memory barriers)

The following definitions make use of extended asm, which is not supported by Arm Compiler 5.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
static inline void dmb(void)
{
asm("dmb" ::: "memory");
}
static inline void dsb(void)
{
asm("dsb" ::: "memory");
}
static inline void isb(void)
{
asm("isb" ::: "memory");
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

These functions are used here:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void mmu_configure(void *tlb)
{
assert(!mmu_is_enabled());
/* Translation Table Base Register 0 */
cp15_write_ttbr0((unsigned int)tlb);
/* Domain Access Register */
/* only domain 15: access are not checked */
cp15_write_dacr(0xC0000000);
dsb();
isb();
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Can these instructions be replaced by the intrinsics __dmb(0xF), __dsb(0xF) and __isb(0xF) to achieve same behavior of the compiler?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void mmu_configure(void *tlb)
{
assert(!mmu_is_enabled());
/* Translation Table Base Register 0 */
cp15_write_ttbr0((unsigned int)tlb);
/* Domain Access Register */
/* only domain 15: access are not checked */
cp15_write_dacr(0xC0000000);
__dsb(0xF);
__isb(0xF);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

0