/*
* 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
*/
/*
*/
#include <brand_misc.h>
#if defined(lint)
void
brand_handler(void)
{
}
#else /* !lint */
#define PIC_SETUP(r) \
/*
* Translate a global symbol into an address. The resulting address
* is returned in the first register parameter. The second register
* is just for scratch space.
*/
#if defined(__sparcv9)
#else /* !__sparcv9 */
#endif /* !__sparcv9 */
.section ".text"
/*
* When we get here, %g1 should contain the system call and
* %g5 should contain the address immediately after the trap
* instruction.
*/
/*
* 64-bit sparc may need to save 3 parameters on the stack.
* 32-bit sparc may need to save 4 parameters on the stack.
*
* Our stack frame format is documented in brand_misc.h.
*/
/*
* Save the current caller state into gregs and gwins.
* Note that this state isn't exact, %g1 and %g5 have been
* already been lost. Also, we've pushed a stack frame so
* the callers output registers are our input registers.
*/
#if defined(__sparcv9)
#endif /* __sparcv9 */
/*
* Look up the system call's entry in the sysent table
* and obtain the address of the proper emulation routine (%l2).
*/
/*
* Look up the system call's entry in the sysent table,
* taking into account the posibility of indirect system calls, and
* obtain the number of arguments (%l4) and return value flag (%l3).
*/
#if defined(__sparcv9)
#else /* !__sparcv9 */
/*
* Check for indirect system calls, in which case the real syscall
* number is the first parameter to the indirect system call.
*/
#endif /* !__sparcv9 */
/*
* Setup arguments for our emulation call. Our input arguments,
* 0 to N, will become emulation call arguments 1 to N+1.
* %l4 == number of arguments.
*/
/* 7th argument and above get passed on the stack */
#if !defined(__sparcv9)
#endif /* !__sparcv9 */
/*
* The first parameter to the emulation callback function is a
* pointer to a sysret_t structure.
*
* invoke the emulation routine.
*/
/* Check for syscall emulation success or failure */
ba return
/* There is always at least one return value. */
return:
/*
* Our syscall emulation is complete. Return to the caller that
* originally invoked a system which needed emulation. Note that
* we have to load the return address that we saved earlier because
* it's possible that %g5 was overwritten by a nested call into
* this emulation library.
*/
restore /* delay slot */
#endif /* !lint */