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