/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBC_I386_INC_SYS_H
#define _LIBC_I386_INC_SYS_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file defines common code sequences for system calls.
*/
#include <sys/asm_linkage.h>
#define _prologue_ \
call 9f; \
9: \
#define _epilogue_ \
/*
* Define the external symbols __cerror and __cerror64 for all files.
*/
/*
* __SYSCALLINT provides the basic trap sequence. It assumes that an entry
*/
/* CSTYLED */ \
int $T_SYSCALLINT
/*
* __SYSENTER provides a faster variant that is only able to
* return rval1. Note that %ecx and %edx are ALWAYS smashed.
*/
call 8f; \
/* CSTYLED */ \
sysenter; \
9:
/*
* __SYSCALL provides a faster variant on processors and kernels
* that support it. Note that %ecx is ALWAYS smashed.
*/
/* CSTYLED */ \
#if defined(_SYSC_INSN)
#else /* _SYSC_INSN */
#if defined(_SEP_INSN)
#else /* _SEP_INSN */
#endif /* _SEP_INSN */
#endif /* _SYSC_INSN */
/*
* SYSFASTTRAP provides the fast system call trap sequence. It assumes
*/
/* CSTYLED */ \
int $T_FASTTRAP
/*
* SYSCERROR provides the sequence to branch to __cerror if an error is
* indicated by the carry-bit being set upon return from a trap.
*/
#define SYSCERROR \
/*
* SYSCERROR64 provides the sequence to branch to __cerror64 if an error is
* indicated by the carry-bit being set upon return from a trap.
*/
#define SYSCERROR64 \
/*
* SYSLWPERR provides the sequence to return 0 on a successful trap
* and the error code if unsuccessful.
* Error is indicated by the carry-bit being set upon return from a trap.
*/
#define SYSLWPERR \
jae 1f; \
jne 2f; \
jmp 2f; \
1: \
2:
/*
* SYSREENTRY provides the entry sequence for restartable system calls.
*/
/* CSTYLED */ \
/*
* SYSRESTART provides the error handling sequence for restartable
* system calls.
*/
jae 1f; \
1:
/*
* SYSINTR_RESTART provides the error handling sequence for restartable
* system calls in case of EINTR or ERESTART.
*/
jae 1f; \
jmp 2f; \
1: \
2:
/*
* SYSCALL provides the standard (i.e.: most common) system call sequence.
*/
SYSTRAP_2RVALS(name); \
SYSTRAP_RVAL1(name); \
/*
* SYSCALL64 provides the standard (i.e.: most common) system call sequence
* for system calls that return 64-bit values.
*/
SYSTRAP_64RVAL(name); \
/*
* SYSCALL_RESTART provides the most common restartable system call sequence.
*/
SYSREENTRY(name); \
SYSTRAP_2RVALS(name); \
/* CSTYLED */ \
SYSREENTRY(name); \
SYSTRAP_RVAL1(name); \
/* CSTYLED */ \
/*
* SYSCALL2 provides a common system call sequence when the entry name
* is different than the trap name.
*/
/*
* SYSCALL2_RESTART provides a common restartable system call sequence when the
* entry name is different than the trap name.
*/
SYSREENTRY(entryname); \
/* CSTYLED */ \
SYSREENTRY(entryname); \
/* CSTYLED */ \
/*
* SYSCALL_NOERROR provides the most common system call sequence for those
* system calls which don't check the error return (carry bit).
*/
/*
* Standard syscall return sequence, return code equal to rval1.
*/
#define RET \
/*
* Syscall return sequence, return code equal to rval2.
*/
#define RET2 \
/*
* Syscall return sequence with return code forced to zero.
*/
#define RETC \
#endif /* _LIBC_I386_INC_SYS_H */