diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2015-01-06 03:50:43 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2015-01-06 03:50:43 +0000 |
commit | 5de1b857a0f8b40d58ffb6bc6876312516ca397c (patch) | |
tree | 14f24de90530d06eb211a4a96ac699fc966d0d23 | |
parent | 0c99d3fb5488d53a1b6c9afd134fb9f7066e373a (diff) | |
download | FreeBSD-src-5de1b857a0f8b40d58ffb6bc6876312516ca397c.zip FreeBSD-src-5de1b857a0f8b40d58ffb6bc6876312516ca397c.tar.gz |
Avoid use of register variables. Clang 3.5 treats this as undefined behavior,
and bad things happen.
MFC after: 1 week
-rw-r--r-- | lib/libc/powerpc/gen/_set_tp.c | 3 | ||||
-rw-r--r-- | lib/libc/powerpc64/gen/_set_tp.c | 3 | ||||
-rw-r--r-- | lib/libthr/arch/powerpc/include/pthread_md.h | 14 |
3 files changed, 9 insertions, 11 deletions
diff --git a/lib/libc/powerpc/gen/_set_tp.c b/lib/libc/powerpc/gen/_set_tp.c index 5a89698..aa1150a 100644 --- a/lib/libc/powerpc/gen/_set_tp.c +++ b/lib/libc/powerpc/gen/_set_tp.c @@ -29,7 +29,6 @@ void _set_tp(void *tpval) { - register void *tp __asm__("r2"); - __asm __volatile("mr %0,%1" : "=r"(tp) : "r"((char*)tpval + 0x7008)); + __asm __volatile("mr 2,%0" :: "r"((char*)tpval + 0x7008)); } diff --git a/lib/libc/powerpc64/gen/_set_tp.c b/lib/libc/powerpc64/gen/_set_tp.c index 9adb6a5..32137e5 100644 --- a/lib/libc/powerpc64/gen/_set_tp.c +++ b/lib/libc/powerpc64/gen/_set_tp.c @@ -29,7 +29,6 @@ void _set_tp(void *tpval) { - register void *tp __asm__("r13"); - __asm __volatile("mr %0,%1" : "=r"(tp) : "r"((char*)tpval + 0x7010)); + __asm __volatile("mr 13,%0" :: "r"((char*)tpval + 0x7010)); } diff --git a/lib/libthr/arch/powerpc/include/pthread_md.h b/lib/libthr/arch/powerpc/include/pthread_md.h index 91102b4..3563297 100644 --- a/lib/libthr/arch/powerpc/include/pthread_md.h +++ b/lib/libthr/arch/powerpc/include/pthread_md.h @@ -62,22 +62,22 @@ static __inline void _tcb_set(struct tcb *tcb) { #ifdef __powerpc64__ - register uint8_t *_tp __asm__("%r13"); + __asm __volatile("mr 13,%0" :: + "r"((uint8_t *)tcb + TP_OFFSET)); #else - register uint8_t *_tp __asm__("%r2"); -#endif - - __asm __volatile("mr %0,%1" : "=r"(_tp) : + __asm __volatile("mr 2,%0" :: "r"((uint8_t *)tcb + TP_OFFSET)); +#endif } static __inline struct tcb * _tcb_get(void) { + register uint8_t *_tp; #ifdef __powerpc64__ - register uint8_t *_tp __asm__("%r13"); + __asm __volatile("mr %0,13" : "=r"(_tp)); #else - register uint8_t *_tp __asm__("%r2"); + __asm __volatile("mr %0,2" : "=r"(_tp)); #endif return ((struct tcb *)(_tp - TP_OFFSET)); |