/*
* 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_SPARCV9_INC_SYS_H
#define _LIBC_SPARCV9_INC_SYS_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file defines common code sequences for system calls. Note that
* it is assumed that __cerror is within the short branch distance from
* all the traps (so that a simple bcs can follow the trap, rather than
* a position independent code sequence.)
*/
#include <sys/asm_linkage.h>
/*
* While it's tempting to imagine we could use 'rd %pc' here,
* in fact it's a rather slow operation that consumes many
* cycles, so we use the usual side-effect of 'call' instead.
*/
#define PIC_SETUP(r) \
/*
* Trap number for system calls
*/
/*
* Define the external symbol __cerror for all files.
*/
/*
* __SYSTRAP provides the basic trap sequence. It assumes that an entry
*/
/* CSTYLED */ \
/*
* SYSFASTTRAP provides the fast system call trap sequence. It assumes
*/
/* CSTYLED */ \
/*
* 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 \
/* CSTYLED */ \
/*
* 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 \
/* CSTYLED */ \
1:
/*
* SYSREENTRY provides the entry sequence for restartable system calls.
*/
/* CSTYLED */ \
/*
* SYSRESTART provides the error handling sequence for restartable
* system calls.
*/
/* CSTYLED */ \
/* CSTYLED */ \
/* CSTYLED */ \
1:
/*
* SYSINTR_RESTART provides the error handling sequence for restartable
* system calls in case of EINTR or ERESTART.
*/
/* CSTYLED */ \
/* CSTYLED */ \
/* CSTYLED */ \
1:
/*
* SYSCALL provides the standard (i.e.: most common) system call sequence.
*/
SYSTRAP_2RVALS(name); \
SYSTRAP_RVAL1(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 \
retl; \
/*
* Syscall return sequence, return code equal to rval2.
*/
#define RET2 \
retl; \
/*
* Syscall return sequence with return code forced to zero.
*/
#define RETC \
retl; \
#endif /* _LIBC_SPARCV9_INC_SYS_H */