198944Sobrien/*-
298944Sobrien * Copyright (c) 2014 Andrew Turner
319370Spst * All rights reserved.
419370Spst *
519370Spst * Redistribution and use in source and binary forms, with or without
698944Sobrien * modification, are permitted provided that the following conditions
719370Spst * are met:
898944Sobrien * 1. Redistributions of source code must retain the above copyright
998944Sobrien *    notice, this list of conditions and the following disclaimer.
1046283Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1198944Sobrien *    notice, this list of conditions and the following disclaimer in the
1298944Sobrien *    documentation and/or other materials provided with the distribution.
1398944Sobrien *
1498944Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1598944Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1698944Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1719370Spst * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1819370Spst * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1919370Spst * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2098944Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2119370Spst * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2219370Spst * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2398944Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2419370Spst * SUCH DAMAGE.
2519370Spst */
2698944Sobrien
2798944Sobrien#include <sys/cdefs.h>
2819370Spst__FBSDID("$FreeBSD: releng/11.0/lib/libc/aarch64/gen/_set_tp.c 288019 2015-09-20 04:59:01Z rodrigc $");
2919370Spst
3019370Spst#include <string.h>
3119370Spst#include <sys/types.h>
3298944Sobrien
3398944Sobrien#include <machine/sysarch.h>
3419370Spst
3598944Sobrien#include <stdlib.h>
3698944Sobrien#include "libc_private.h"
3798944Sobrien
3898944Sobrienvoid
3998944Sobrien_set_tp(void *tp)
4098944Sobrien{
4198944Sobrien
4298944Sobrien	asm volatile("msr	tpidr_el0, %0" : : "r"(tp));
4398944Sobrien}
4419370Spst