xref: /netbsd-src/lib/libc/arch/arm/sys/__aeabi_read_tp.S (revision 7788a0781fe6ff2cce37368b4578a7ade0850cb1)
1/* $NetBSD: __aeabi_read_tp.S,v 1.3 2012/11/20 22:02:46 matt Exp $ */
2
3#include "SYS.h"
4
5/*
6 * Implementations of this function should corrupt only the result register
7 * (r0) and the non-parameter integer core registers allowed to be corrupted
8 * by the [AAPCS] (ip, lr, and CPSR).
9 */
10ENTRY(__aeabi_read_tp)
11	mrc	p15, 0, r0, c13, c0, 3
12#ifndef _ARM_ARCH_6
13	cmp	r0, #0			/* was it zero? */
14	RETc(ne)			/* return it's not zero */
15	mov	ip, r1			/* syscall zeroes r1 */
16	SYSTRAP(_lwp_getprivate)	/* can't fail */
17	mov	r1, ip			/* restore r1 */
18#endif
19	RET
20_END(__aeabi_read_tp)
21