/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
#include <sys/segments.h>
#include <sys/privregs.h>
int
{
int rval;
if (thisthread)
#if defined(__amd64)
/*
* 32-bit compatibility processes point to the per-cpu GDT segment
* descriptors that are virtualized to the lwp. That allows 32-bit
* programs to mess with %fs and %gs; in particular it allows
* things like this:
*
* movw %gs, %ax
* ...
* movw %ax, %gs
*
* to work, which is needed by emulators for legacy application
* environments ..
*
* 64-bit processes may also point to a per-cpu GDT segment descriptor
* virtualized to the lwp. However the descriptor base is forced
* to zero (because we can't express the full 64-bit address range
* in a long mode descriptor), so don't reload segment registers
* in a 64-bit program! 64-bit processes must have selector values
* of zero for %fs and %gs to use the 64-bit fs_base and gs_base
* respectively.
*/
if (pcb->pcb_rupdate == 0) {
t->t_post_sys = 1;
}
ASSERT(t->t_post_sys);
switch (which) {
case _LWP_FSBASE:
} else {
}
if (thisthread)
break;
case _LWP_GSBASE:
} else {
}
if (thisthread)
break;
default:
rval = -1;
break;
}
/*
* 32-bit processes point to the per-cpu GDT segment
* descriptors that are virtualized to the lwp.
*/
switch (which) {
case _LWP_FSBASE:
if (thisthread)
break;
case _LWP_GSBASE:
if (thisthread)
break;
default:
rval = -1;
break;
}
#endif /* __i386 */
if (thisthread)
return (rval);
}
static int
{
int error = 0;
switch (which) {
#if defined(__amd64)
case _LWP_FSBASE:
break;
} else {
break;
}
} else {
break;
} else {
break;
}
}
}
break;
case _LWP_GSBASE:
break;
} else {
break;
}
} else {
break;
} else {
break;
}
}
}
break;
case _LWP_FSBASE:
break;
}
break;
case _LWP_GSBASE:
break;
}
break;
#endif /* __i386 */
default:
break;
}
if (error != 0)
return (error);
#if defined(_SYSCALL32_IMPL)
} else {
#endif
}
return (error);
}
/*
* libc-private syscall for managing per-lwp %gs and %fs segment base values.
*/
int
{
switch (cmd) {
case _LWP_SETPRIVATE:
case _LWP_GETPRIVATE:
default:
}
}