ARM atomic_full_barrier implementation question
Lael Jones
lael.jones@gmail.com
Thu Apr 28 20:38:00 GMT 2011
Recently I was searching for a barrier type instruction for use on ARM
when working on a project and came across the implementation used in
the glibc ports directory in atomic.h for the ARM:
#ifdef __thumb2__
#define atomic_full_barrier() \
__asm__ __volatile__ \
("movw\tip, #0x0fa0\n\t" \
"movt\tip, #0xffff\n\t" \
"blx\tip" \
: : : "ip", "lr", "cc", "memory");
#else
#define atomic_full_barrier() \
__asm__ __volatile__ \
("mov\tip, #0xffff0fff\n\t" \
"mov\tlr, pc\n\t" \
"add\tpc, ip, #(0xffff0fa0 - 0xffff0fff)" \
: : : "ip", "lr", "cc", "memory");
#endif
This looks to me like it is making a function call to a fixed address.
Can someone explain exactly how this implements a barrier? Does the
Linux kernel install some code at that specific address?
Thanks
Lael Jones
More information about the Libc-ports
mailing list