2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 2N/A * Translate a global symbol into an address. The resulting address 2N/A * is returned in the first register parameter. The second register 2N/A * is just for scratch space. 2N/A#
else /* !__sparcv9 */ 2N/A#
endif /* !__sparcv9 */ 2N/A * When we get here, %g1 should contain the system call and 2N/A * %g5 should contain the address immediately after the trap 2N/A * 64-bit sparc may need to save 3 parameters on the stack. 2N/A * 32-bit sparc may need to save 4 parameters on the stack. 2N/A * Save the current caller state into gregs and gwins. 2N/A * Note that this state isn't exact, %g1 and %g5 have been 2N/A * already been lost. Also, we've pushed a stack frame so 2N/A * the callers output registers are our input registers. 2N/A#
endif /* __sparcv9 */ 2N/A * Look up the system call's entry in the sysent table 2N/A * and obtain the address of the proper emulation routine (%l2). 2N/A * Look up the system call's entry in the sysent table, 2N/A * taking into account the posibility of indirect system calls, and 2N/A * obtain the number of arguments (%l4) and return value flag (%l3). 2N/A#
else /* !__sparcv9 */ 2N/A * Check for indirect system calls, in which case the real syscall 2N/A * number is the first parameter to the indirect system call. 2N/A#
endif /* !__sparcv9 */ 2N/A * Setup arguments for our emulation call. Our input arguments, 2N/A * 0 to N, will become emulation call arguments 1 to N+1. 2N/A * %l4 == number of arguments. 2N/A /* 7th argument and above get passed on the stack */ 2N/A#
endif /* !__sparcv9 */ 2N/A * The first parameter to the emulation callback function is a 2N/A * pointer to a sysret_t structure. 2N/A * invoke the emulation routine. 2N/A /* Check for syscall emulation success or failure */ 2N/A /* There is always at least one return value. */ 2N/A * Our syscall emulation is complete. Return to the caller that 2N/A * originally invoked a system which needed emulation. Note that 2N/A * we have to load the return address that we saved earlier because 2N/A * it's possible that %g5 was overwritten by a nested call into 2N/A * this emulation library.