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.

static inline void dmb(void)
{
	asm("dmb" ::: "memory");
}

static inline void dsb(void)
{
	asm("dsb" ::: "memory");
}

static inline void isb(void)
{
	asm("isb" ::: "memory");
}

These functions are used here:

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();
}

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

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);
}

Parents Reply Children
No data