_set_tp.c revision 239271
196896Sgrog/*- 296896Sgrog * Copyright (c) 2004 Doug Rabson 396896Sgrog * All rights reserved. 496896Sgrog * 596896Sgrog * Redistribution and use in source and binary forms, with or without 696897Sgrog * modification, are permitted provided that the following conditions 796897Sgrog * are met: 896897Sgrog * 1. Redistributions of source code must retain the above copyright 996897Sgrog * notice, this list of conditions and the following disclaimer. 1096897Sgrog * 2. Redistributions in binary form must reproduce the above copyright 1196897Sgrog * notice, this list of conditions and the following disclaimer in the 1296897Sgrog * documentation and/or other materials provided with the distribution. 1396897Sgrog * 1496897Sgrog * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1596897Sgrog * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1696897Sgrog * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1796897Sgrog * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1896897Sgrog * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1996897Sgrog * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2096897Sgrog * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2196897Sgrog * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2296897Sgrog * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2396897Sgrog * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2496897Sgrog * SUCH DAMAGE. 2596897Sgrog * 2696897Sgrog * $FreeBSD: head/lib/libc/arm/gen/_set_tp.c 239271 2012-08-15 03:09:00Z gonzo $ 2796897Sgrog */ 2896897Sgrog 2996897Sgrog#include <string.h> 3096897Sgrog#include <sys/types.h> 3196897Sgrog 3296897Sgrog#include <machine/sysarch.h> 3396897Sgrog 3496897Sgrogvoid 3596897Sgrog_set_tp(void *tp) 3696897Sgrog{ 3796897Sgrog 3896897Sgrog#ifdef ARM_TP_ADDRESS 3996897Sgrog *((struct tcb **)ARM_TP_ADDRESS) = tp; 4096897Sgrog#else 4196897Sgrog sysarch(ARM_SET_TP, tp); 4296897Sgrog#endif 4396896Sgrog} 4496896Sgrog