1*538e5fbcSmatt/* $NetBSD: __aeabi_read_tp.S,v 1.5 2013/08/19 22:10:51 matt Exp $ */ 219392803Smatt 3*538e5fbcSmatt#undef __thumb__ 410dc456dSjoerg#include "SYS.h" 510dc456dSjoerg 619392803Smatt/* 719392803Smatt * Implementations of this function should corrupt only the result register 819392803Smatt * (r0) and the non-parameter integer core registers allowed to be corrupted 919392803Smatt * by the [AAPCS] (ip, lr, and CPSR). 1019392803Smatt */ 11*538e5fbcSmattARM_ENTRY(__aeabi_read_tp) 1210dc456dSjoerg mrc p15, 0, r0, c13, c0, 3 1362335767Smatt#ifndef _ARM_ARCH_6 1462335767Smatt cmp r0, #0 /* was it zero? */ 1562335767Smatt RETc(ne) /* return it's not zero */ 1619392803Smatt mov ip, r1 /* syscall zeroes r1 */ 1762335767Smatt SYSTRAP(_lwp_getprivate) /* can't fail */ 1819392803Smatt mov r1, ip /* restore r1 */ 1962335767Smatt#endif 2010dc456dSjoerg RET 213216032cSmattEND(__aeabi_read_tp) 22