xref: /onnv-gate/usr/src/lib/libproc/sparc/Pisadep.c (revision 10201:47013accbd9c)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
53347Sab196087  * Common Development and Distribution License (the "License").
63347Sab196087  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*10201SEdward.Pilatowicz@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #include <sys/stack.h>
270Sstevel@tonic-gate #include <sys/regset.h>
280Sstevel@tonic-gate #include <sys/frame.h>
290Sstevel@tonic-gate #include <sys/sysmacros.h>
30*10201SEdward.Pilatowicz@Sun.COM #include <sys/machelf.h>
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #include <stdlib.h>
330Sstevel@tonic-gate #include <unistd.h>
340Sstevel@tonic-gate #include <sys/types.h>
350Sstevel@tonic-gate #include <errno.h>
360Sstevel@tonic-gate #include <string.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #include "Pcontrol.h"
390Sstevel@tonic-gate #include "Pstack.h"
400Sstevel@tonic-gate #include "Pisadep.h"
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #define	SYSCALL32 0x91d02008	/* 32-bit syscall (ta 8) instruction */
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #ifndef	WINDOWSIZE32
450Sstevel@tonic-gate #define	WINDOWSIZE32	(16 * sizeof (int32_t))
460Sstevel@tonic-gate #endif
470Sstevel@tonic-gate 
480Sstevel@tonic-gate const char *
Ppltdest(struct ps_prochandle * P,uintptr_t pltaddr)490Sstevel@tonic-gate Ppltdest(struct ps_prochandle *P, uintptr_t pltaddr)
500Sstevel@tonic-gate {
510Sstevel@tonic-gate 	map_info_t *mp = Paddr2mptr(P, pltaddr);
520Sstevel@tonic-gate 
530Sstevel@tonic-gate 	uintptr_t r_addr;
540Sstevel@tonic-gate 	file_info_t *fp;
550Sstevel@tonic-gate 	Elf32_Rela r;
560Sstevel@tonic-gate 	size_t i;
570Sstevel@tonic-gate 
580Sstevel@tonic-gate 	if (mp == NULL || (fp = mp->map_file) == NULL ||
590Sstevel@tonic-gate 	    fp->file_plt_base == 0 || pltaddr < fp->file_plt_base ||
600Sstevel@tonic-gate 	    pltaddr >= fp->file_plt_base + fp->file_plt_size) {
610Sstevel@tonic-gate 		errno = EINVAL;
620Sstevel@tonic-gate 		return (NULL);
630Sstevel@tonic-gate 	}
640Sstevel@tonic-gate 
650Sstevel@tonic-gate 	i = (pltaddr - fp->file_plt_base -
66*10201SEdward.Pilatowicz@Sun.COM 	    M_PLT_XNumber * M32_PLT_ENTSIZE) / M32_PLT_ENTSIZE;
670Sstevel@tonic-gate 
680Sstevel@tonic-gate 	r_addr = fp->file_jmp_rel + i * sizeof (Elf32_Rela);
690Sstevel@tonic-gate 
700Sstevel@tonic-gate 	if (Pread(P, &r, sizeof (r), r_addr) == sizeof (r) &&
710Sstevel@tonic-gate 	    (i = ELF32_R_SYM(r.r_info)) < fp->file_dynsym.sym_symn) {
720Sstevel@tonic-gate 
733347Sab196087 		Elf_Data *data = fp->file_dynsym.sym_data_pri;
740Sstevel@tonic-gate 		Elf32_Sym *symp = &(((Elf32_Sym *)data->d_buf)[i]);
750Sstevel@tonic-gate 
760Sstevel@tonic-gate 		return (fp->file_dynsym.sym_strs + symp->st_name);
770Sstevel@tonic-gate 	}
780Sstevel@tonic-gate 
790Sstevel@tonic-gate 	return (NULL);
800Sstevel@tonic-gate }
810Sstevel@tonic-gate 
820Sstevel@tonic-gate int
Pissyscall(struct ps_prochandle * P,uintptr_t addr)830Sstevel@tonic-gate Pissyscall(struct ps_prochandle *P, uintptr_t addr)
840Sstevel@tonic-gate {
850Sstevel@tonic-gate 	instr_t sysinstr;
860Sstevel@tonic-gate 	instr_t instr;
870Sstevel@tonic-gate 
880Sstevel@tonic-gate 	sysinstr = SYSCALL32;
890Sstevel@tonic-gate 
900Sstevel@tonic-gate 	if (Pread(P, &instr, sizeof (instr), addr) != sizeof (instr) ||
910Sstevel@tonic-gate 	    instr != sysinstr)
920Sstevel@tonic-gate 		return (0);
930Sstevel@tonic-gate 	else
940Sstevel@tonic-gate 		return (1);
950Sstevel@tonic-gate }
960Sstevel@tonic-gate 
970Sstevel@tonic-gate int
Pissyscall_prev(struct ps_prochandle * P,uintptr_t addr,uintptr_t * dst)980Sstevel@tonic-gate Pissyscall_prev(struct ps_prochandle *P, uintptr_t addr, uintptr_t *dst)
990Sstevel@tonic-gate {
1000Sstevel@tonic-gate 	uintptr_t prevaddr = addr - sizeof (instr_t);
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate 	if (Pissyscall(P, prevaddr)) {
1030Sstevel@tonic-gate 		if (dst)
1040Sstevel@tonic-gate 			*dst = prevaddr;
1050Sstevel@tonic-gate 		return (1);
1060Sstevel@tonic-gate 	}
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate 	return (0);
1090Sstevel@tonic-gate }
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate /* ARGSUSED */
1120Sstevel@tonic-gate int
Pissyscall_text(struct ps_prochandle * P,const void * buf,size_t buflen)1130Sstevel@tonic-gate Pissyscall_text(struct ps_prochandle *P, const void *buf, size_t buflen)
1140Sstevel@tonic-gate {
1150Sstevel@tonic-gate 	instr_t sysinstr;
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate 	sysinstr = SYSCALL32;
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate 	if (buflen >= sizeof (instr_t) &&
1200Sstevel@tonic-gate 	    memcmp(buf, &sysinstr, sizeof (instr_t)) == 0)
1210Sstevel@tonic-gate 		return (1);
1220Sstevel@tonic-gate 	else
1230Sstevel@tonic-gate 		return (0);
1240Sstevel@tonic-gate }
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate /*
1270Sstevel@tonic-gate  * For gwindows_t support, we define a structure to pass arguments to
1280Sstevel@tonic-gate  * a Plwp_iter() callback routine.
1290Sstevel@tonic-gate  */
1300Sstevel@tonic-gate typedef struct {
1310Sstevel@tonic-gate 	struct ps_prochandle *gq_proc;	/* libproc handle */
1320Sstevel@tonic-gate 	struct rwindow *gq_rwin;	/* rwindow destination buffer */
1330Sstevel@tonic-gate 	uintptr_t gq_addr;		/* stack address to match */
1340Sstevel@tonic-gate } gwin_query_t;
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate static int
find_gwin(gwin_query_t * gqp,const lwpstatus_t * psp)1370Sstevel@tonic-gate find_gwin(gwin_query_t *gqp, const lwpstatus_t *psp)
1380Sstevel@tonic-gate {
1390Sstevel@tonic-gate 	gwindows_t gwin;
1400Sstevel@tonic-gate 	struct stat64 st;
1410Sstevel@tonic-gate 	char path[64];
1420Sstevel@tonic-gate 	ssize_t n;
1430Sstevel@tonic-gate 	int fd, i;
1440Sstevel@tonic-gate 	int rv = 0; /* Return value for skip to next lwp */
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate 	(void) snprintf(path, sizeof (path), "/proc/%d/lwp/%d/gwindows",
1470Sstevel@tonic-gate 	    (int)gqp->gq_proc->pid, (int)psp->pr_lwpid);
1480Sstevel@tonic-gate 
1490Sstevel@tonic-gate 	if (stat64(path, &st) == -1 || st.st_size == 0)
1500Sstevel@tonic-gate 		return (0); /* Nothing doing; skip to next lwp */
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate 	if ((fd = open64(path, O_RDONLY)) >= 0) {
1530Sstevel@tonic-gate 		/*
1540Sstevel@tonic-gate 		 * Zero out the gwindows_t because the gwindows file only has
1550Sstevel@tonic-gate 		 * as much data as needed to represent the saved windows.
1560Sstevel@tonic-gate 		 */
1570Sstevel@tonic-gate 		(void) memset(&gwin, 0, sizeof (gwin));
1580Sstevel@tonic-gate 		n = read(fd, &gwin, sizeof (gwin));
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate 		if (n > 0) {
1610Sstevel@tonic-gate 			/*
1620Sstevel@tonic-gate 			 * If we actually found a non-zero gwindows file and
1630Sstevel@tonic-gate 			 * were able to read it, iterate through the buffers
1640Sstevel@tonic-gate 			 * looking for a stack pointer match; if one is found,
1650Sstevel@tonic-gate 			 * copy out the corresponding register window.
1660Sstevel@tonic-gate 			 */
1670Sstevel@tonic-gate 			for (i = 0; i < gwin.wbcnt; i++) {
1680Sstevel@tonic-gate 				if (gwin.spbuf[i] == (greg_t *)gqp->gq_addr) {
1690Sstevel@tonic-gate 					(void) memcpy(gqp->gq_rwin,
1700Sstevel@tonic-gate 					    &gwin.wbuf[i],
1710Sstevel@tonic-gate 					    sizeof (struct rwindow));
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate 					rv = 1; /* We're done */
1740Sstevel@tonic-gate 					break;
1750Sstevel@tonic-gate 				}
1760Sstevel@tonic-gate 			}
1770Sstevel@tonic-gate 		}
1780Sstevel@tonic-gate 		(void) close(fd);
1790Sstevel@tonic-gate 	}
1800Sstevel@tonic-gate 
1810Sstevel@tonic-gate 	return (rv);
1820Sstevel@tonic-gate }
1830Sstevel@tonic-gate 
1840Sstevel@tonic-gate static int
read_gwin(struct ps_prochandle * P,struct rwindow * rwp,uintptr_t sp)1850Sstevel@tonic-gate read_gwin(struct ps_prochandle *P, struct rwindow *rwp, uintptr_t sp)
1860Sstevel@tonic-gate {
1870Sstevel@tonic-gate 	gwin_query_t gq;
1880Sstevel@tonic-gate 
1890Sstevel@tonic-gate 	if (P->state == PS_DEAD) {
1900Sstevel@tonic-gate 		lwp_info_t *lwp = list_next(&P->core->core_lwp_head);
1910Sstevel@tonic-gate 		uint_t n;
1920Sstevel@tonic-gate 		int i;
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate 		for (n = 0; n < P->core->core_nlwp; n++, lwp = list_next(lwp)) {
1950Sstevel@tonic-gate 			gwindows_t *gwin = lwp->lwp_gwins;
1960Sstevel@tonic-gate 
1970Sstevel@tonic-gate 			if (gwin == NULL)
1980Sstevel@tonic-gate 				continue; /* No gwindows for this lwp */
1990Sstevel@tonic-gate 
2000Sstevel@tonic-gate 			/*
2010Sstevel@tonic-gate 			 * If this lwp has gwindows associated with it, iterate
2020Sstevel@tonic-gate 			 * through the buffers looking for a stack pointer
2030Sstevel@tonic-gate 			 * match; if one is found, copy out the register window.
2040Sstevel@tonic-gate 			 */
2050Sstevel@tonic-gate 			for (i = 0; i < gwin->wbcnt; i++) {
2060Sstevel@tonic-gate 				if (gwin->spbuf[i] == (greg_t *)sp) {
2070Sstevel@tonic-gate 					(void) memcpy(rwp, &gwin->wbuf[i],
2080Sstevel@tonic-gate 					    sizeof (struct rwindow));
2090Sstevel@tonic-gate 					return (0); /* We're done */
2100Sstevel@tonic-gate 				}
2110Sstevel@tonic-gate 			}
2120Sstevel@tonic-gate 		}
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate 		return (-1); /* No gwindows match found */
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate 	}
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate 	gq.gq_proc = P;
2190Sstevel@tonic-gate 	gq.gq_rwin = rwp;
2200Sstevel@tonic-gate 	gq.gq_addr = sp;
2210Sstevel@tonic-gate 
2220Sstevel@tonic-gate 	return (Plwp_iter(P, (proc_lwp_f *)find_gwin, &gq) ? 0 : -1);
2230Sstevel@tonic-gate }
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate static void
ucontext_n_to_prgregs(const ucontext_t * src,prgregset_t dst)2260Sstevel@tonic-gate ucontext_n_to_prgregs(const ucontext_t *src, prgregset_t dst)
2270Sstevel@tonic-gate {
2280Sstevel@tonic-gate 	const greg_t *gregs = &src->uc_mcontext.gregs[0];
2290Sstevel@tonic-gate 
2300Sstevel@tonic-gate 	dst[R_PSR] = gregs[REG_PSR];
2310Sstevel@tonic-gate 	dst[R_PC] = gregs[REG_PC];
2320Sstevel@tonic-gate 	dst[R_nPC] = gregs[REG_nPC];
2330Sstevel@tonic-gate 	dst[R_Y] = gregs[REG_Y];
2340Sstevel@tonic-gate 
2350Sstevel@tonic-gate 	dst[R_G1] = gregs[REG_G1];
2360Sstevel@tonic-gate 	dst[R_G2] = gregs[REG_G2];
2370Sstevel@tonic-gate 	dst[R_G3] = gregs[REG_G3];
2380Sstevel@tonic-gate 	dst[R_G4] = gregs[REG_G4];
2390Sstevel@tonic-gate 	dst[R_G5] = gregs[REG_G5];
2400Sstevel@tonic-gate 	dst[R_G6] = gregs[REG_G6];
2410Sstevel@tonic-gate 	dst[R_G7] = gregs[REG_G7];
2420Sstevel@tonic-gate 
2430Sstevel@tonic-gate 	dst[R_O0] = gregs[REG_O0];
2440Sstevel@tonic-gate 	dst[R_O1] = gregs[REG_O1];
2450Sstevel@tonic-gate 	dst[R_O2] = gregs[REG_O2];
2460Sstevel@tonic-gate 	dst[R_O3] = gregs[REG_O3];
2470Sstevel@tonic-gate 	dst[R_O4] = gregs[REG_O4];
2480Sstevel@tonic-gate 	dst[R_O5] = gregs[REG_O5];
2490Sstevel@tonic-gate 	dst[R_O6] = gregs[REG_O6];
2500Sstevel@tonic-gate 	dst[R_O7] = gregs[REG_O7];
2510Sstevel@tonic-gate }
2520Sstevel@tonic-gate 
2530Sstevel@tonic-gate int
Pstack_iter(struct ps_prochandle * P,const prgregset_t regs,proc_stack_f * func,void * arg)2540Sstevel@tonic-gate Pstack_iter(struct ps_prochandle *P, const prgregset_t regs,
2550Sstevel@tonic-gate 	proc_stack_f *func, void *arg)
2560Sstevel@tonic-gate {
2570Sstevel@tonic-gate 	prgreg_t *prevfp = NULL;
2580Sstevel@tonic-gate 	uint_t pfpsize = 0;
2590Sstevel@tonic-gate 	int nfp = 0;
2600Sstevel@tonic-gate 	prgregset_t gregs;
2610Sstevel@tonic-gate 	long args[6];
2620Sstevel@tonic-gate 	prgreg_t fp;
2630Sstevel@tonic-gate 	int i;
2640Sstevel@tonic-gate 	int rv;
2650Sstevel@tonic-gate 	uintptr_t sp;
2660Sstevel@tonic-gate 	ssize_t n;
2670Sstevel@tonic-gate 	uclist_t ucl;
2680Sstevel@tonic-gate 	ucontext_t uc;
2690Sstevel@tonic-gate 
2700Sstevel@tonic-gate 	init_uclist(&ucl, P);
2710Sstevel@tonic-gate 	(void) memcpy(gregs, regs, sizeof (gregs));
2720Sstevel@tonic-gate 
2730Sstevel@tonic-gate 	for (;;) {
2740Sstevel@tonic-gate 		fp = gregs[R_FP];
2750Sstevel@tonic-gate 		if (stack_loop(fp, &prevfp, &nfp, &pfpsize))
2760Sstevel@tonic-gate 			break;
2770Sstevel@tonic-gate 
2780Sstevel@tonic-gate 		for (i = 0; i < 6; i++)
2790Sstevel@tonic-gate 			args[i] = gregs[R_I0 + i];
2800Sstevel@tonic-gate 		if ((rv = func(arg, gregs, 6, args)) != 0)
2810Sstevel@tonic-gate 			break;
2820Sstevel@tonic-gate 
2830Sstevel@tonic-gate 		gregs[R_PC] = gregs[R_I7];
2840Sstevel@tonic-gate 		gregs[R_nPC] = gregs[R_PC] + 4;
2850Sstevel@tonic-gate 		(void) memcpy(&gregs[R_O0], &gregs[R_I0], 8*sizeof (prgreg_t));
2860Sstevel@tonic-gate 		if ((sp = gregs[R_FP]) == 0)
2870Sstevel@tonic-gate 			break;
2880Sstevel@tonic-gate 
2890Sstevel@tonic-gate 		sp += STACK_BIAS;
2900Sstevel@tonic-gate 
2910Sstevel@tonic-gate 		if (find_uclink(&ucl, sp + SA(sizeof (struct frame))) &&
2920Sstevel@tonic-gate 		    Pread(P, &uc, sizeof (uc), sp +
2930Sstevel@tonic-gate 		    SA(sizeof (struct frame))) == sizeof (uc)) {
2940Sstevel@tonic-gate 			ucontext_n_to_prgregs(&uc, gregs);
2950Sstevel@tonic-gate 			sp = gregs[R_SP] + STACK_BIAS;
2960Sstevel@tonic-gate 		}
2970Sstevel@tonic-gate 
2980Sstevel@tonic-gate 		n = Pread(P, &gregs[R_L0], sizeof (struct rwindow), sp);
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate 		if (n == sizeof (struct rwindow))
3010Sstevel@tonic-gate 			continue;
3020Sstevel@tonic-gate 
3030Sstevel@tonic-gate 		/*
3040Sstevel@tonic-gate 		 * If we get here, then our Pread of the register window
3050Sstevel@tonic-gate 		 * failed.  If this is because the address was not mapped,
3060Sstevel@tonic-gate 		 * then we attempt to read this window via any gwindows
3070Sstevel@tonic-gate 		 * information we have.  If that too fails, abort our loop.
3080Sstevel@tonic-gate 		 */
3090Sstevel@tonic-gate 		if (n > 0)
3100Sstevel@tonic-gate 			break;	/* Failed for reason other than not mapped */
3110Sstevel@tonic-gate 
3120Sstevel@tonic-gate 		if (read_gwin(P, (struct rwindow *)&gregs[R_L0], sp) == -1)
3130Sstevel@tonic-gate 			break;	/* No gwindows match either */
3140Sstevel@tonic-gate 	}
3150Sstevel@tonic-gate 
3160Sstevel@tonic-gate 	if (prevfp)
3170Sstevel@tonic-gate 		free(prevfp);
3180Sstevel@tonic-gate 
3190Sstevel@tonic-gate 	free_uclist(&ucl);
3200Sstevel@tonic-gate 	return (rv);
3210Sstevel@tonic-gate }
3220Sstevel@tonic-gate 
3230Sstevel@tonic-gate uintptr_t
Psyscall_setup(struct ps_prochandle * P,int nargs,int sysindex,uintptr_t sp)3240Sstevel@tonic-gate Psyscall_setup(struct ps_prochandle *P, int nargs, int sysindex, uintptr_t sp)
3250Sstevel@tonic-gate {
3260Sstevel@tonic-gate 	sp -= (nargs > 6)?
327*10201SEdward.Pilatowicz@Sun.COM 	    WINDOWSIZE32 + sizeof (int32_t) * (1 + nargs) :
328*10201SEdward.Pilatowicz@Sun.COM 	    WINDOWSIZE32 + sizeof (int32_t) * (1 + 6);
3290Sstevel@tonic-gate 	sp = PSTACK_ALIGN32(sp);
3300Sstevel@tonic-gate 
3310Sstevel@tonic-gate 	P->status.pr_lwp.pr_reg[R_G1] = sysindex;
3320Sstevel@tonic-gate 	P->status.pr_lwp.pr_reg[R_SP] = sp;
3330Sstevel@tonic-gate 	P->status.pr_lwp.pr_reg[R_PC] = P->sysaddr;
3340Sstevel@tonic-gate 	P->status.pr_lwp.pr_reg[R_nPC] = P->sysaddr + sizeof (instr_t);
3350Sstevel@tonic-gate 
3360Sstevel@tonic-gate 	return (sp + WINDOWSIZE32 + sizeof (int32_t));
3370Sstevel@tonic-gate }
3380Sstevel@tonic-gate 
3390Sstevel@tonic-gate int
Psyscall_copyinargs(struct ps_prochandle * P,int nargs,argdes_t * argp,uintptr_t ap)3400Sstevel@tonic-gate Psyscall_copyinargs(struct ps_prochandle *P, int nargs, argdes_t *argp,
3410Sstevel@tonic-gate     uintptr_t ap)
3420Sstevel@tonic-gate {
3430Sstevel@tonic-gate 	uint32_t arglist[MAXARGS+2];
3440Sstevel@tonic-gate 	int i;
3450Sstevel@tonic-gate 	argdes_t *adp;
3460Sstevel@tonic-gate 
3470Sstevel@tonic-gate 	for (i = 0, adp = argp; i < nargs; i++, adp++) {
3480Sstevel@tonic-gate 		arglist[i] = adp->arg_value;
3490Sstevel@tonic-gate 
3500Sstevel@tonic-gate 		if (i < 6)
3510Sstevel@tonic-gate 			(void) Pputareg(P, R_O0+i, adp->arg_value);
3520Sstevel@tonic-gate 	}
3530Sstevel@tonic-gate 
3540Sstevel@tonic-gate 	if (nargs > 6 &&
3550Sstevel@tonic-gate 	    Pwrite(P, &arglist[0], sizeof (int32_t) * nargs,
3560Sstevel@tonic-gate 	    (uintptr_t)ap) != sizeof (int32_t) * nargs)
3570Sstevel@tonic-gate 		return (-1);
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate 	return (0);
3600Sstevel@tonic-gate }
3610Sstevel@tonic-gate 
3620Sstevel@tonic-gate /* ARGSUSED */
3630Sstevel@tonic-gate int
Psyscall_copyoutargs(struct ps_prochandle * P,int nargs,argdes_t * argp,uintptr_t ap)3640Sstevel@tonic-gate Psyscall_copyoutargs(struct ps_prochandle *P, int nargs, argdes_t *argp,
3650Sstevel@tonic-gate     uintptr_t ap)
3660Sstevel@tonic-gate {
3670Sstevel@tonic-gate 	/* Do nothing */
3680Sstevel@tonic-gate 	return (0);
3690Sstevel@tonic-gate }
370