i386_set_gsbase.c revision 145036
1194246Smarius/*-
2194246Smarius * Copyright (c) 2005 Peter Wemm
3194246Smarius * All rights reserved.
4194246Smarius *
5194246Smarius * Redistribution and use in source and binary forms, with or without
6194246Smarius * modification, are permitted provided that the following conditions
7194246Smarius * are met:
8194246Smarius * 1. Redistributions of source code must retain the above copyright
9194246Smarius *    notice, this list of conditions and the following disclaimer.
10194246Smarius * 2. Redistributions in binary form must reproduce the above copyright
11194246Smarius *    notice, this list of conditions and the following disclaimer in the
12194246Smarius *    documentation and/or other materials provided with the distribution.
13194246Smarius *
14194246Smarius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15194246Smarius * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16194246Smarius * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17194246Smarius * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18194246Smarius * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19194246Smarius * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20194246Smarius * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21194246Smarius * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22194246Smarius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23194246Smarius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24194246Smarius * SUCH DAMAGE.
25194246Smarius */
26194246Smarius
27194246Smarius#include <sys/cdefs.h>
28194246Smarius__FBSDID("$FreeBSD: head/lib/libc/i386/sys/i386_set_gsbase.c 145036 2005-04-14 00:01:35Z peter $");
29194246Smarius
30194246Smarius#include <machine/sysarch.h>
31194246Smarius
32194246Smariusint
33194246Smariusi386_set_gsbase(void *addr)
34194246Smarius{
35194246Smarius
36194246Smarius	return (sysarch(I386_SET_GSBASE, &addr));
37194246Smarius}
38194246Smarius