Blame sysdeps/aarch64/tls-macros.h

Packit 6c4009
/* Copyright (C) 2009-2018 Free Software Foundation, Inc.
Packit 6c4009
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public License as
Packit 6c4009
   published by the Free Software Foundation; either version 2.1 of the
Packit 6c4009
   License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#define TLS_LD(x) TLS_GD(x)
Packit 6c4009
Packit 6c4009
#define TLS_GD(x)					\
Packit 6c4009
  ({ register unsigned long __result asm ("x0");	\
Packit 6c4009
     asm ("adrp	%0, :tlsgd:" #x "; "			\
Packit 6c4009
	  "add	%0, %0, #:tlsgd_lo12:" #x "; "		\
Packit 6c4009
	  "bl	__tls_get_addr;"			\
Packit 6c4009
	  "nop"						\
Packit 6c4009
	  : "=r" (__result)				\
Packit 6c4009
	  :						\
Packit 6c4009
	  : "x1", "x2", "x3", "x4", "x5", "x6",		\
Packit 6c4009
	    "x7", "x8", "x9", "x10", "x11", "x12",	\
Packit 6c4009
	    "x13", "x14", "x15", "x16", "x17", "x18",	\
Packit 6c4009
	    "x30", "memory", "cc");			\
Packit 6c4009
     (int *) (__result); })
Packit 6c4009
Packit 6c4009
#define TLS_IE(x)					\
Packit 6c4009
  ({ register unsigned long __result asm ("x0");	\
Packit 6c4009
     register unsigned long __t;			\
Packit 6c4009
     asm ("mrs	%1, tpidr_el0; "			\
Packit 6c4009
	  "adrp	%0, :gottprel:" #x "; "			\
Packit 6c4009
	  "ldr	%0, [%0, #:gottprel_lo12:" #x "]; "	\
Packit 6c4009
	  "add	%0, %0, %1"				\
Packit 6c4009
	  : "=r" (__result), "=r" (__t));		\
Packit 6c4009
     (int *) (__result); })
Packit 6c4009
Packit 6c4009
#define TLS_LE(x)					\
Packit 6c4009
  ({ register unsigned long __result asm ("x0");	\
Packit 6c4009
     asm ("mrs	%0, tpidr_el0; "			\
Packit 6c4009
	  "add	%0, %0, :tprel_hi12:" #x "; "		\
Packit 6c4009
	  "add	%0, %0, :tprel_lo12_nc:" #x		\
Packit 6c4009
	  : "=r" (__result));				\
Packit 6c4009
     (int *) (__result); })