2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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 *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _PISADEP_H
2N/A#define _PISADEP_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * Internal ISA-dependent functions.
2N/A *
2N/A * Note that some ISA-dependent functions are exposed to applications, and found
2N/A * in libproc.h:
2N/A *
2N/A * Ppltdest()
2N/A * Pissyscall_prev()
2N/A * Pstack_iter()
2N/A */
2N/A
2N/A/*
2N/A * ISA dependent function to determine if the instruction at the given address
2N/A * is a syscall instruction. On x86, we have multiple system call instructions.
2N/A * this function returns 1 if there is a system call at the given address, 2 if
2N/A * there is a less preferred system call, and 0 if there is no system call
2N/A * there.
2N/A */
2N/Aextern int Pissyscall(struct ps_prochandle *, uintptr_t);
2N/A/*
2N/A * Works the same way as Pissyscall(), except operates on an in-memory buffer.
2N/A */
2N/Aextern int Pissyscall_text(struct ps_prochandle *, const void *buf,
2N/A size_t buflen);
2N/A
2N/A#if defined(__amd64)
2N/A/* amd64 stack doubleword aligned, unaligned in 32-bit mode */
2N/A#define PSTACK_ALIGN32(sp) ((sp) & ~(2 * sizeof (int64_t) - 1))
2N/A#define PSTACK_ALIGN64(sp) (sp)
2N/A#elif defined(__i386)
2N/A/* i386 stack is unaligned */
2N/A#define PSTACK_ALIGN32(sp) (sp)
2N/A#define PSTACK_ALIGN64(sp) ALIGN32(sp)
2N/A#elif defined(__sparc)
2N/A/* sparc stack is doubleword aligned for 64-bit values */
2N/A#define PSTACK_ALIGN32(sp) ((sp) & ~(2 * sizeof (int32_t) - 1))
2N/A#define PSTACK_ALIGN64(sp) ((sp) & ~(2 * sizeof (int64_t) - 1))
2N/A#else
2N/A#error Unknown ISA
2N/A#endif
2N/A
2N/A/*
2N/A * Given an argument count, stack pointer, and syscall index, sets up the stack
2N/A * and appropriate registers. The stack pointer should be the top of the stack
2N/A * area, after any space reserved for arguments passed by reference. Returns a
2N/A * pointer which is later passed to Psyscall_copyargs().
2N/A */
2N/Aextern uintptr_t Psyscall_setup(struct ps_prochandle *, int, int, uintptr_t);
2N/A
2N/A/*
2N/A * Copies all arguments out to the stack once we're stopped before the syscall.
2N/A */
2N/Aextern int Psyscall_copyinargs(struct ps_prochandle *, int, argdes_t *,
2N/A uintptr_t);
2N/A
2N/A/*
2N/A * Copies out arguments to their original values.
2N/A */
2N/Aextern int Psyscall_copyoutargs(struct ps_prochandle *, int, argdes_t *,
2N/A uintptr_t);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _PISADEP_H */