1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #include <sys/stack.h> 30*7c478bd9Sstevel@tonic-gate #include <sys/regset.h> 31*7c478bd9Sstevel@tonic-gate #include <sys/frame.h> 32*7c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 33*7c478bd9Sstevel@tonic-gate #include <sys/trap.h> 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 36*7c478bd9Sstevel@tonic-gate #include <unistd.h> 37*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 38*7c478bd9Sstevel@tonic-gate #include <errno.h> 39*7c478bd9Sstevel@tonic-gate #include <string.h> 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #include "Pcontrol.h" 42*7c478bd9Sstevel@tonic-gate #include "Pstack.h" 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate #define M_PLT_NRSV 1 /* reserved PLT entries */ 45*7c478bd9Sstevel@tonic-gate #define M_PLT_ENTSIZE 16 /* size of each PLT entry */ 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate static uchar_t int_syscall_instr[] = { 0xCD, T_SYSCALLINT }; 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate const char * 50*7c478bd9Sstevel@tonic-gate Ppltdest(struct ps_prochandle *P, uintptr_t pltaddr) 51*7c478bd9Sstevel@tonic-gate { 52*7c478bd9Sstevel@tonic-gate map_info_t *mp = Paddr2mptr(P, pltaddr); 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate uintptr_t r_addr; 55*7c478bd9Sstevel@tonic-gate file_info_t *fp; 56*7c478bd9Sstevel@tonic-gate Elf32_Rel r; 57*7c478bd9Sstevel@tonic-gate size_t i; 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate if (mp == NULL || (fp = mp->map_file) == NULL || 60*7c478bd9Sstevel@tonic-gate fp->file_plt_base == 0 || 61*7c478bd9Sstevel@tonic-gate pltaddr - fp->file_plt_base >= fp->file_plt_size) { 62*7c478bd9Sstevel@tonic-gate errno = EINVAL; 63*7c478bd9Sstevel@tonic-gate return (NULL); 64*7c478bd9Sstevel@tonic-gate } 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate i = (pltaddr - fp->file_plt_base) / M_PLT_ENTSIZE - M_PLT_NRSV; 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate r_addr = fp->file_jmp_rel + i * sizeof (r); 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate if (Pread(P, &r, sizeof (r), r_addr) == sizeof (r) && 71*7c478bd9Sstevel@tonic-gate (i = ELF32_R_SYM(r.r_info)) < fp->file_dynsym.sym_symn) { 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate Elf_Data *data = fp->file_dynsym.sym_data; 74*7c478bd9Sstevel@tonic-gate Elf32_Sym *symp = &(((Elf32_Sym *)data->d_buf)[i]); 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate return (fp->file_dynsym.sym_strs + symp->st_name); 77*7c478bd9Sstevel@tonic-gate } 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate return (NULL); 80*7c478bd9Sstevel@tonic-gate } 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate int 83*7c478bd9Sstevel@tonic-gate Pissyscall(struct ps_prochandle *P, uintptr_t addr) 84*7c478bd9Sstevel@tonic-gate { 85*7c478bd9Sstevel@tonic-gate uchar_t instr[16]; 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate if (Pread(P, instr, sizeof (int_syscall_instr), addr) != 88*7c478bd9Sstevel@tonic-gate sizeof (int_syscall_instr)) 89*7c478bd9Sstevel@tonic-gate return (0); 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate if (memcmp(instr, int_syscall_instr, sizeof (int_syscall_instr)) == 0) 92*7c478bd9Sstevel@tonic-gate return (1); 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate return (0); 95*7c478bd9Sstevel@tonic-gate } 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate int 98*7c478bd9Sstevel@tonic-gate Pissyscall_prev(struct ps_prochandle *P, uintptr_t addr, uintptr_t *dst) 99*7c478bd9Sstevel@tonic-gate { 100*7c478bd9Sstevel@tonic-gate int ret; 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate if (ret = Pissyscall(P, addr - sizeof (int_syscall_instr))) { 103*7c478bd9Sstevel@tonic-gate if (dst) 104*7c478bd9Sstevel@tonic-gate *dst = addr - sizeof (int_syscall_instr); 105*7c478bd9Sstevel@tonic-gate return (ret); 106*7c478bd9Sstevel@tonic-gate } 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate return (0); 109*7c478bd9Sstevel@tonic-gate } 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate /* ARGSUSED */ 112*7c478bd9Sstevel@tonic-gate int 113*7c478bd9Sstevel@tonic-gate Pissyscall_text(struct ps_prochandle *P, const void *buf, size_t buflen) 114*7c478bd9Sstevel@tonic-gate { 115*7c478bd9Sstevel@tonic-gate if (buflen < sizeof (int_syscall_instr)) 116*7c478bd9Sstevel@tonic-gate return (0); 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate if (memcmp(buf, int_syscall_instr, sizeof (int_syscall_instr)) == 0) 119*7c478bd9Sstevel@tonic-gate return (1); 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate return (0); 122*7c478bd9Sstevel@tonic-gate } 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate #define TR_ARG_MAX 6 /* Max args to print, same as SPARC */ 125*7c478bd9Sstevel@tonic-gate 126*7c478bd9Sstevel@tonic-gate /* 127*7c478bd9Sstevel@tonic-gate * Given a return address, determine the likely number of arguments 128*7c478bd9Sstevel@tonic-gate * that were pushed on the stack prior to its execution. We do this by 129*7c478bd9Sstevel@tonic-gate * expecting that a typical call sequence consists of pushing arguments on 130*7c478bd9Sstevel@tonic-gate * the stack, executing a call instruction, and then performing an add 131*7c478bd9Sstevel@tonic-gate * on %esp to restore it to the value prior to pushing the arguments for 132*7c478bd9Sstevel@tonic-gate * the call. We attempt to detect such an add, and divide the addend 133*7c478bd9Sstevel@tonic-gate * by the size of a word to determine the number of pushed arguments. 134*7c478bd9Sstevel@tonic-gate * 135*7c478bd9Sstevel@tonic-gate * If we do not find such an add, this does not necessarily imply that the 136*7c478bd9Sstevel@tonic-gate * function took no arguments. It is not possible to reliably detect such a 137*7c478bd9Sstevel@tonic-gate * void function because hand-coded assembler does not always perform an add 138*7c478bd9Sstevel@tonic-gate * to %esp immediately after the "call" instruction (eg. _sys_call()). 139*7c478bd9Sstevel@tonic-gate * Because of this, we default to returning MIN(sz, TR_ARG_MAX) instead of 0 140*7c478bd9Sstevel@tonic-gate * in the absence of an add to %esp. 141*7c478bd9Sstevel@tonic-gate */ 142*7c478bd9Sstevel@tonic-gate static ulong_t 143*7c478bd9Sstevel@tonic-gate argcount(struct ps_prochandle *P, long pc, ssize_t sz) 144*7c478bd9Sstevel@tonic-gate { 145*7c478bd9Sstevel@tonic-gate uchar_t instr[6]; 146*7c478bd9Sstevel@tonic-gate ulong_t count, max; 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate max = MIN(sz / sizeof (long), TR_ARG_MAX); 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate /* 151*7c478bd9Sstevel@tonic-gate * Read the instruction at the return location. 152*7c478bd9Sstevel@tonic-gate */ 153*7c478bd9Sstevel@tonic-gate if (Pread(P, instr, sizeof (instr), pc) != sizeof (instr) || 154*7c478bd9Sstevel@tonic-gate instr[1] != 0xc4) 155*7c478bd9Sstevel@tonic-gate return (max); 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate switch (instr[0]) { 158*7c478bd9Sstevel@tonic-gate case 0x81: /* count is a longword */ 159*7c478bd9Sstevel@tonic-gate count = instr[2]+(instr[3]<<8)+(instr[4]<<16)+(instr[5]<<24); 160*7c478bd9Sstevel@tonic-gate break; 161*7c478bd9Sstevel@tonic-gate case 0x83: /* count is a byte */ 162*7c478bd9Sstevel@tonic-gate count = instr[2]; 163*7c478bd9Sstevel@tonic-gate break; 164*7c478bd9Sstevel@tonic-gate default: 165*7c478bd9Sstevel@tonic-gate return (max); 166*7c478bd9Sstevel@tonic-gate } 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate count /= sizeof (long); 169*7c478bd9Sstevel@tonic-gate return (MIN(count, max)); 170*7c478bd9Sstevel@tonic-gate } 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate static void 173*7c478bd9Sstevel@tonic-gate ucontext_n_to_prgregs(const ucontext_t *src, prgregset_t dst) 174*7c478bd9Sstevel@tonic-gate { 175*7c478bd9Sstevel@tonic-gate (void) memcpy(dst, src->uc_mcontext.gregs, sizeof (gregset_t)); 176*7c478bd9Sstevel@tonic-gate } 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate int 179*7c478bd9Sstevel@tonic-gate Pstack_iter(struct ps_prochandle *P, const prgregset_t regs, 180*7c478bd9Sstevel@tonic-gate proc_stack_f *func, void *arg) 181*7c478bd9Sstevel@tonic-gate { 182*7c478bd9Sstevel@tonic-gate prgreg_t *prevfp = NULL; 183*7c478bd9Sstevel@tonic-gate uint_t pfpsize = 0; 184*7c478bd9Sstevel@tonic-gate int nfp = 0; 185*7c478bd9Sstevel@tonic-gate struct { 186*7c478bd9Sstevel@tonic-gate long fp; 187*7c478bd9Sstevel@tonic-gate long pc; 188*7c478bd9Sstevel@tonic-gate long args[32]; 189*7c478bd9Sstevel@tonic-gate } frame; 190*7c478bd9Sstevel@tonic-gate uint_t argc; 191*7c478bd9Sstevel@tonic-gate ssize_t sz; 192*7c478bd9Sstevel@tonic-gate prgregset_t gregs; 193*7c478bd9Sstevel@tonic-gate prgreg_t fp, pfp; 194*7c478bd9Sstevel@tonic-gate prgreg_t pc; 195*7c478bd9Sstevel@tonic-gate int rv; 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate /* 198*7c478bd9Sstevel@tonic-gate * Type definition for a structure corresponding to an IA32 199*7c478bd9Sstevel@tonic-gate * signal frame. Refer to the comments in Pstack.c for more info 200*7c478bd9Sstevel@tonic-gate */ 201*7c478bd9Sstevel@tonic-gate typedef struct { 202*7c478bd9Sstevel@tonic-gate long fp; 203*7c478bd9Sstevel@tonic-gate long pc; 204*7c478bd9Sstevel@tonic-gate int signo; 205*7c478bd9Sstevel@tonic-gate ucontext_t *ucp; 206*7c478bd9Sstevel@tonic-gate siginfo_t *sip; 207*7c478bd9Sstevel@tonic-gate } sf_t; 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate uclist_t ucl; 210*7c478bd9Sstevel@tonic-gate ucontext_t uc; 211*7c478bd9Sstevel@tonic-gate uintptr_t uc_addr; 212*7c478bd9Sstevel@tonic-gate 213*7c478bd9Sstevel@tonic-gate init_uclist(&ucl, P); 214*7c478bd9Sstevel@tonic-gate (void) memcpy(gregs, regs, sizeof (gregs)); 215*7c478bd9Sstevel@tonic-gate 216*7c478bd9Sstevel@tonic-gate fp = regs[R_FP]; 217*7c478bd9Sstevel@tonic-gate pc = regs[R_PC]; 218*7c478bd9Sstevel@tonic-gate 219*7c478bd9Sstevel@tonic-gate while (fp != 0 || pc != 0) { 220*7c478bd9Sstevel@tonic-gate if (stack_loop(fp, &prevfp, &nfp, &pfpsize)) 221*7c478bd9Sstevel@tonic-gate break; 222*7c478bd9Sstevel@tonic-gate 223*7c478bd9Sstevel@tonic-gate if (fp != 0 && 224*7c478bd9Sstevel@tonic-gate (sz = Pread(P, &frame, sizeof (frame), (uintptr_t)fp) 225*7c478bd9Sstevel@tonic-gate >= (ssize_t)(2* sizeof (long)))) { 226*7c478bd9Sstevel@tonic-gate /* 227*7c478bd9Sstevel@tonic-gate * One more trick for signal frames: the kernel sets 228*7c478bd9Sstevel@tonic-gate * the return pc of the signal frame to 0xffffffff on 229*7c478bd9Sstevel@tonic-gate * Intel IA32, so argcount won't work. 230*7c478bd9Sstevel@tonic-gate */ 231*7c478bd9Sstevel@tonic-gate if (frame.pc != -1L) { 232*7c478bd9Sstevel@tonic-gate sz -= 2* sizeof (long); 233*7c478bd9Sstevel@tonic-gate argc = argcount(P, (long)frame.pc, sz); 234*7c478bd9Sstevel@tonic-gate } else 235*7c478bd9Sstevel@tonic-gate argc = 3; /* sighandler(signo, sip, ucp) */ 236*7c478bd9Sstevel@tonic-gate } else { 237*7c478bd9Sstevel@tonic-gate (void) memset(&frame, 0, sizeof (frame)); 238*7c478bd9Sstevel@tonic-gate argc = 0; 239*7c478bd9Sstevel@tonic-gate } 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate gregs[R_FP] = fp; 242*7c478bd9Sstevel@tonic-gate gregs[R_PC] = pc; 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate if ((rv = func(arg, gregs, argc, frame.args)) != 0) 245*7c478bd9Sstevel@tonic-gate break; 246*7c478bd9Sstevel@tonic-gate 247*7c478bd9Sstevel@tonic-gate /* 248*7c478bd9Sstevel@tonic-gate * In order to allow iteration over java frames (which can have 249*7c478bd9Sstevel@tonic-gate * their own frame pointers), we allow the iterator to change 250*7c478bd9Sstevel@tonic-gate * the contents of gregs. If we detect a change, then we assume 251*7c478bd9Sstevel@tonic-gate * that the new values point to the next frame. 252*7c478bd9Sstevel@tonic-gate */ 253*7c478bd9Sstevel@tonic-gate if (gregs[R_FP] != fp || gregs[R_PC] != pc) { 254*7c478bd9Sstevel@tonic-gate fp = gregs[R_FP]; 255*7c478bd9Sstevel@tonic-gate pc = gregs[R_PC]; 256*7c478bd9Sstevel@tonic-gate continue; 257*7c478bd9Sstevel@tonic-gate } 258*7c478bd9Sstevel@tonic-gate 259*7c478bd9Sstevel@tonic-gate pfp = fp; 260*7c478bd9Sstevel@tonic-gate fp = frame.fp; 261*7c478bd9Sstevel@tonic-gate pc = frame.pc; 262*7c478bd9Sstevel@tonic-gate 263*7c478bd9Sstevel@tonic-gate if (find_uclink(&ucl, pfp + sizeof (sf_t))) 264*7c478bd9Sstevel@tonic-gate uc_addr = pfp + sizeof (sf_t); 265*7c478bd9Sstevel@tonic-gate else 266*7c478bd9Sstevel@tonic-gate uc_addr = NULL; 267*7c478bd9Sstevel@tonic-gate 268*7c478bd9Sstevel@tonic-gate if (uc_addr != NULL && 269*7c478bd9Sstevel@tonic-gate Pread(P, &uc, sizeof (uc), uc_addr) == sizeof (uc)) { 270*7c478bd9Sstevel@tonic-gate 271*7c478bd9Sstevel@tonic-gate ucontext_n_to_prgregs(&uc, gregs); 272*7c478bd9Sstevel@tonic-gate fp = gregs[R_FP]; 273*7c478bd9Sstevel@tonic-gate pc = gregs[R_PC]; 274*7c478bd9Sstevel@tonic-gate } 275*7c478bd9Sstevel@tonic-gate } 276*7c478bd9Sstevel@tonic-gate 277*7c478bd9Sstevel@tonic-gate if (prevfp) 278*7c478bd9Sstevel@tonic-gate free(prevfp); 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate free_uclist(&ucl); 281*7c478bd9Sstevel@tonic-gate return (rv); 282*7c478bd9Sstevel@tonic-gate } 283*7c478bd9Sstevel@tonic-gate 284*7c478bd9Sstevel@tonic-gate uintptr_t 285*7c478bd9Sstevel@tonic-gate Psyscall_setup(struct ps_prochandle *P, int nargs, int sysindex, uintptr_t sp) 286*7c478bd9Sstevel@tonic-gate { 287*7c478bd9Sstevel@tonic-gate sp -= sizeof (int) * (nargs+2); /* space for arg list + CALL parms */ 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate P->status.pr_lwp.pr_reg[EAX] = sysindex; 290*7c478bd9Sstevel@tonic-gate P->status.pr_lwp.pr_reg[R_SP] = sp; 291*7c478bd9Sstevel@tonic-gate P->status.pr_lwp.pr_reg[R_PC] = P->sysaddr; 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate return (sp); 294*7c478bd9Sstevel@tonic-gate } 295*7c478bd9Sstevel@tonic-gate 296*7c478bd9Sstevel@tonic-gate int 297*7c478bd9Sstevel@tonic-gate Psyscall_copyinargs(struct ps_prochandle *P, int nargs, argdes_t *argp, 298*7c478bd9Sstevel@tonic-gate uintptr_t ap) 299*7c478bd9Sstevel@tonic-gate { 300*7c478bd9Sstevel@tonic-gate int32_t arglist[MAXARGS+2]; 301*7c478bd9Sstevel@tonic-gate int i; 302*7c478bd9Sstevel@tonic-gate argdes_t *adp; 303*7c478bd9Sstevel@tonic-gate 304*7c478bd9Sstevel@tonic-gate for (i = 0, adp = argp; i < nargs; i++, adp++) 305*7c478bd9Sstevel@tonic-gate arglist[1 + i] = (int32_t)adp->arg_value; 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate arglist[0] = P->status.pr_lwp.pr_reg[R_PC]; 308*7c478bd9Sstevel@tonic-gate if (Pwrite(P, &arglist[0], sizeof (int) * (nargs+1), 309*7c478bd9Sstevel@tonic-gate (uintptr_t)ap) != sizeof (int) * (nargs+1)) 310*7c478bd9Sstevel@tonic-gate return (-1); 311*7c478bd9Sstevel@tonic-gate 312*7c478bd9Sstevel@tonic-gate return (0); 313*7c478bd9Sstevel@tonic-gate } 314*7c478bd9Sstevel@tonic-gate 315*7c478bd9Sstevel@tonic-gate int 316*7c478bd9Sstevel@tonic-gate Psyscall_copyoutargs(struct ps_prochandle *P, int nargs, argdes_t *argp, 317*7c478bd9Sstevel@tonic-gate uintptr_t ap) 318*7c478bd9Sstevel@tonic-gate { 319*7c478bd9Sstevel@tonic-gate uint32_t arglist[MAXARGS + 2]; 320*7c478bd9Sstevel@tonic-gate int i; 321*7c478bd9Sstevel@tonic-gate argdes_t *adp; 322*7c478bd9Sstevel@tonic-gate 323*7c478bd9Sstevel@tonic-gate if (Pread(P, &arglist[0], sizeof (int) * (nargs+1), (uintptr_t)ap) 324*7c478bd9Sstevel@tonic-gate != sizeof (int) * (nargs+1)) 325*7c478bd9Sstevel@tonic-gate return (-1); 326*7c478bd9Sstevel@tonic-gate 327*7c478bd9Sstevel@tonic-gate for (i = 0, adp = argp; i < nargs; i++, adp++) 328*7c478bd9Sstevel@tonic-gate adp->arg_value = arglist[i]; 329*7c478bd9Sstevel@tonic-gate 330*7c478bd9Sstevel@tonic-gate return (0); 331*7c478bd9Sstevel@tonic-gate } 332