Changeset View
Changeset View
Standalone View
Standalone View
lib/libthr/arch/powerpc/include/pthread_md.h
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | #else | ||||
__asm __volatile("mr 2,%0" :: | __asm __volatile("mr 2,%0" :: | ||||
"r"((uint8_t *)tcb + TP_OFFSET)); | "r"((uint8_t *)tcb + TP_OFFSET)); | ||||
#endif | #endif | ||||
} | } | ||||
static __inline struct tcb * | static __inline struct tcb * | ||||
_tcb_get(void) | _tcb_get(void) | ||||
{ | { | ||||
register uint8_t *_tp; | register struct tcb *tcb; | ||||
#ifdef __powerpc64__ | #ifdef __powerpc64__ | ||||
__asm __volatile("mr %0,13" : "=r"(_tp)); | __asm __volatile("addi %0,13,%1" : "=r"(tcb) : "i"(-TP_OFFSET)); | ||||
#else | #else | ||||
__asm __volatile("mr %0,2" : "=r"(_tp)); | __asm __volatile("addi %0,2,%1" : "=r"(tcb) : "i"(-TP_OFFSET)); | ||||
#endif | #endif | ||||
return ((struct tcb *)(_tp - TP_OFFSET)); | return (tcb); | ||||
} | } | ||||
static __inline struct pthread * | static __inline struct pthread * | ||||
_get_curthread(void) | _get_curthread(void) | ||||
{ | { | ||||
if (_thr_initial) | if (_thr_initial) | ||||
return (_tcb_get()->tcb_thread); | return (_tcb_get()->tcb_thread); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
#endif /* _PTHREAD_MD_H_ */ | #endif /* _PTHREAD_MD_H_ */ |