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 5*2685Sakolb * Common Development and Distribution License (the "License"). 6*2685Sakolb * 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 */ 211048Sraf 220Sstevel@tonic-gate /* 23*2685Sakolb * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/types.h> 300Sstevel@tonic-gate #include <sys/mkdev.h> 310Sstevel@tonic-gate #include <sys/regset.h> 320Sstevel@tonic-gate #include <string.h> 330Sstevel@tonic-gate 340Sstevel@tonic-gate #if defined(__amd64) 350Sstevel@tonic-gate #include <sys/fp.h> 360Sstevel@tonic-gate #include <ieeefp.h> 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate #include "P32ton.h" 400Sstevel@tonic-gate 410Sstevel@tonic-gate dev_t 420Sstevel@tonic-gate prexpldev(dev32_t d) 430Sstevel@tonic-gate { 440Sstevel@tonic-gate if (d != (dev32_t)-1L) 450Sstevel@tonic-gate return (makedev((d >> NBITSMINOR32) & MAXMAJ32, d & MAXMIN32)); 460Sstevel@tonic-gate 470Sstevel@tonic-gate return ((dev_t)PRNODEV); 480Sstevel@tonic-gate } 490Sstevel@tonic-gate 500Sstevel@tonic-gate 510Sstevel@tonic-gate dev32_t 520Sstevel@tonic-gate prcmpldev(dev_t d) 530Sstevel@tonic-gate { 540Sstevel@tonic-gate #ifdef _LP64 550Sstevel@tonic-gate if (d == PRNODEV) { 560Sstevel@tonic-gate return (PRNODEV32); 570Sstevel@tonic-gate } else { 580Sstevel@tonic-gate major_t maj = major(d); 590Sstevel@tonic-gate minor_t min = minor(d); 600Sstevel@tonic-gate 610Sstevel@tonic-gate if (maj == (major_t)PRNODEV || min == (minor_t)PRNODEV) 620Sstevel@tonic-gate return (PRNODEV32); 630Sstevel@tonic-gate 640Sstevel@tonic-gate return ((dev32_t)((maj << NBITSMINOR32) | min)); 650Sstevel@tonic-gate } 660Sstevel@tonic-gate #else 670Sstevel@tonic-gate return ((dev32_t)d); 680Sstevel@tonic-gate #endif 690Sstevel@tonic-gate } 700Sstevel@tonic-gate 710Sstevel@tonic-gate #ifdef _LP64 720Sstevel@tonic-gate 730Sstevel@tonic-gate void 740Sstevel@tonic-gate timestruc_32_to_n(const timestruc32_t *src, timestruc_t *dst) 750Sstevel@tonic-gate { 760Sstevel@tonic-gate dst->tv_sec = (time_t)(uint32_t)src->tv_sec; 770Sstevel@tonic-gate dst->tv_nsec = (long)(uint32_t)src->tv_nsec; 780Sstevel@tonic-gate } 790Sstevel@tonic-gate 800Sstevel@tonic-gate void 810Sstevel@tonic-gate stack_32_to_n(const stack32_t *src, stack_t *dst) 820Sstevel@tonic-gate { 830Sstevel@tonic-gate dst->ss_sp = (caddr_t)(uintptr_t)src->ss_sp; 840Sstevel@tonic-gate dst->ss_size = src->ss_size; 850Sstevel@tonic-gate dst->ss_flags = src->ss_flags; 860Sstevel@tonic-gate } 870Sstevel@tonic-gate 880Sstevel@tonic-gate void 890Sstevel@tonic-gate sigaction_32_to_n(const struct sigaction32 *src, struct sigaction *dst) 900Sstevel@tonic-gate { 910Sstevel@tonic-gate (void) memset(dst, 0, sizeof (struct sigaction)); 920Sstevel@tonic-gate dst->sa_flags = src->sa_flags; 930Sstevel@tonic-gate dst->sa_handler = (void (*)())(uintptr_t)src->sa_handler; 940Sstevel@tonic-gate (void) memcpy(&dst->sa_mask, &src->sa_mask, sizeof (dst->sa_mask)); 950Sstevel@tonic-gate } 960Sstevel@tonic-gate 970Sstevel@tonic-gate void 980Sstevel@tonic-gate siginfo_32_to_n(const siginfo32_t *src, siginfo_t *dst) 990Sstevel@tonic-gate { 1000Sstevel@tonic-gate (void) memset(dst, 0, sizeof (siginfo_t)); 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate /* 1030Sstevel@tonic-gate * The absolute minimum content is si_signo and si_code. 1040Sstevel@tonic-gate */ 1050Sstevel@tonic-gate dst->si_signo = src->si_signo; 1060Sstevel@tonic-gate if ((dst->si_code = src->si_code) == SI_NOINFO) 1070Sstevel@tonic-gate return; 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate /* 1100Sstevel@tonic-gate * A siginfo generated by user level is structured 1110Sstevel@tonic-gate * differently from one generated by the kernel. 1120Sstevel@tonic-gate */ 1130Sstevel@tonic-gate if (SI_FROMUSER(src)) { 1140Sstevel@tonic-gate dst->si_pid = src->si_pid; 1150Sstevel@tonic-gate dst->si_ctid = src->si_ctid; 1160Sstevel@tonic-gate dst->si_zoneid = src->si_zoneid; 1170Sstevel@tonic-gate dst->si_uid = src->si_uid; 1180Sstevel@tonic-gate if (SI_CANQUEUE(src->si_code)) { 1190Sstevel@tonic-gate dst->si_value.sival_int = 1200Sstevel@tonic-gate (long)(uint32_t)src->si_value.sival_int; 1210Sstevel@tonic-gate } 1220Sstevel@tonic-gate return; 1230Sstevel@tonic-gate } 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate dst->si_errno = src->si_errno; 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate switch (src->si_signo) { 1280Sstevel@tonic-gate default: 1290Sstevel@tonic-gate dst->si_pid = src->si_pid; 1300Sstevel@tonic-gate dst->si_ctid = src->si_ctid; 1310Sstevel@tonic-gate dst->si_zoneid = src->si_zoneid; 1320Sstevel@tonic-gate dst->si_uid = src->si_uid; 1330Sstevel@tonic-gate dst->si_value.sival_int = 1340Sstevel@tonic-gate (long)(uint32_t)src->si_value.sival_int; 1350Sstevel@tonic-gate break; 1360Sstevel@tonic-gate case SIGCLD: 1370Sstevel@tonic-gate dst->si_pid = src->si_pid; 1380Sstevel@tonic-gate dst->si_ctid = src->si_ctid; 1390Sstevel@tonic-gate dst->si_zoneid = src->si_zoneid; 1400Sstevel@tonic-gate dst->si_status = src->si_status; 1410Sstevel@tonic-gate dst->si_stime = src->si_stime; 1420Sstevel@tonic-gate dst->si_utime = src->si_utime; 1430Sstevel@tonic-gate break; 1440Sstevel@tonic-gate case SIGSEGV: 1450Sstevel@tonic-gate case SIGBUS: 1460Sstevel@tonic-gate case SIGILL: 1470Sstevel@tonic-gate case SIGTRAP: 1480Sstevel@tonic-gate case SIGFPE: 1490Sstevel@tonic-gate case SIGEMT: 1500Sstevel@tonic-gate dst->si_addr = (void *)(uintptr_t)src->si_addr; 1510Sstevel@tonic-gate dst->si_trapno = src->si_trapno; 1520Sstevel@tonic-gate dst->si_pc = (void *)(uintptr_t)src->si_pc; 1530Sstevel@tonic-gate break; 1540Sstevel@tonic-gate case SIGPOLL: 1550Sstevel@tonic-gate case SIGXFSZ: 1560Sstevel@tonic-gate dst->si_fd = src->si_fd; 1570Sstevel@tonic-gate dst->si_band = src->si_band; 1580Sstevel@tonic-gate break; 1590Sstevel@tonic-gate case SIGPROF: 1600Sstevel@tonic-gate dst->si_faddr = (void *)(uintptr_t)src->si_faddr; 1610Sstevel@tonic-gate dst->si_tstamp.tv_sec = src->si_tstamp.tv_sec; 1620Sstevel@tonic-gate dst->si_tstamp.tv_nsec = src->si_tstamp.tv_nsec; 1630Sstevel@tonic-gate dst->si_syscall = src->si_syscall; 1640Sstevel@tonic-gate dst->si_nsysarg = src->si_nsysarg; 1650Sstevel@tonic-gate dst->si_fault = src->si_fault; 1660Sstevel@tonic-gate break; 1670Sstevel@tonic-gate } 1680Sstevel@tonic-gate } 1690Sstevel@tonic-gate 1700Sstevel@tonic-gate void 1710Sstevel@tonic-gate auxv_32_to_n(const auxv32_t *src, auxv_t *dst) 1720Sstevel@tonic-gate { 1730Sstevel@tonic-gate /* 1740Sstevel@tonic-gate * This is a little sketchy: we have three types of values stored 1750Sstevel@tonic-gate * in an auxv (long, void *, and void (*)()) so the only sign-extension 1760Sstevel@tonic-gate * issue is with the long. We could case on all possible AT_* types, 1770Sstevel@tonic-gate * but this seems silly since currently none of the types which use 1780Sstevel@tonic-gate * a_un.a_val actually use negative numbers as a value. For this 1790Sstevel@tonic-gate * reason, it seems simpler to just do an unsigned expansion for now. 1800Sstevel@tonic-gate */ 1810Sstevel@tonic-gate dst->a_type = src->a_type; 1820Sstevel@tonic-gate dst->a_un.a_ptr = (void *)(uintptr_t)src->a_un.a_ptr; 1830Sstevel@tonic-gate } 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate #if defined(__sparc) 1860Sstevel@tonic-gate void 1870Sstevel@tonic-gate rwindow_32_to_n(const struct rwindow32 *src, struct rwindow *dst) 1880Sstevel@tonic-gate { 1890Sstevel@tonic-gate int i; 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate for (i = 0; i < 8; i++) { 1920Sstevel@tonic-gate dst->rw_local[i] = (uint64_t)(uint32_t)src->rw_local[i]; 1930Sstevel@tonic-gate dst->rw_in[i] = (uint64_t)(uint32_t)src->rw_in[i]; 1940Sstevel@tonic-gate } 1950Sstevel@tonic-gate } 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate void 1980Sstevel@tonic-gate gwindows_32_to_n(const gwindows32_t *src, gwindows_t *dst) 1990Sstevel@tonic-gate { 2000Sstevel@tonic-gate int i; 2010Sstevel@tonic-gate 2020Sstevel@tonic-gate (void) memset(dst, 0, sizeof (gwindows_t)); 2030Sstevel@tonic-gate dst->wbcnt = src->wbcnt; 2040Sstevel@tonic-gate 2050Sstevel@tonic-gate for (i = 0; i < src->wbcnt; i++) { 2060Sstevel@tonic-gate if (src->spbuf[i] != 0) { 2070Sstevel@tonic-gate rwindow_32_to_n(&src->wbuf[i], &dst->wbuf[i]); 2081048Sraf dst->spbuf[i] = (greg_t *)(uintptr_t)src->spbuf[i]; 2090Sstevel@tonic-gate } 2100Sstevel@tonic-gate } 2110Sstevel@tonic-gate } 2120Sstevel@tonic-gate #endif /* __sparc */ 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate void 2150Sstevel@tonic-gate prgregset_32_to_n(const prgreg32_t *src, prgreg_t *dst) 2160Sstevel@tonic-gate { 2170Sstevel@tonic-gate #ifdef __amd64 2180Sstevel@tonic-gate (void) memset(dst, 0, NPRGREG * sizeof (prgreg_t)); 2190Sstevel@tonic-gate dst[REG_GS] = (uint32_t)src[GS]; 2200Sstevel@tonic-gate dst[REG_FS] = (uint32_t)src[FS]; 2210Sstevel@tonic-gate dst[REG_DS] = (uint32_t)src[DS]; 2220Sstevel@tonic-gate dst[REG_ES] = (uint32_t)src[ES]; 2230Sstevel@tonic-gate dst[REG_RDI] = (uint32_t)src[EDI]; 2240Sstevel@tonic-gate dst[REG_RSI] = (uint32_t)src[ESI]; 2250Sstevel@tonic-gate dst[REG_RBP] = (uint32_t)src[EBP]; 2260Sstevel@tonic-gate dst[REG_RBX] = (uint32_t)src[EBX]; 2270Sstevel@tonic-gate dst[REG_RDX] = (uint32_t)src[EDX]; 2280Sstevel@tonic-gate dst[REG_RCX] = (uint32_t)src[ECX]; 2290Sstevel@tonic-gate dst[REG_RAX] = (uint32_t)src[EAX]; 2300Sstevel@tonic-gate dst[REG_TRAPNO] = (uint32_t)src[TRAPNO]; 2310Sstevel@tonic-gate dst[REG_ERR] = (uint32_t)src[ERR]; 2320Sstevel@tonic-gate dst[REG_RIP] = (uint32_t)src[EIP]; 2330Sstevel@tonic-gate dst[REG_CS] = (uint32_t)src[CS]; 2340Sstevel@tonic-gate dst[REG_RFL] = (uint32_t)src[EFL]; 2350Sstevel@tonic-gate dst[REG_RSP] = (uint32_t)src[UESP]; 2360Sstevel@tonic-gate dst[REG_SS] = (uint32_t)src[SS]; 2370Sstevel@tonic-gate #else 2380Sstevel@tonic-gate int i; 2390Sstevel@tonic-gate 2400Sstevel@tonic-gate for (i = 0; i < NPRGREG; i++) 2410Sstevel@tonic-gate dst[i] = (prgreg_t)(uint32_t)src[i]; 2420Sstevel@tonic-gate #endif 2430Sstevel@tonic-gate } 2440Sstevel@tonic-gate 2450Sstevel@tonic-gate void 2460Sstevel@tonic-gate prfpregset_32_to_n(const prfpregset32_t *src, prfpregset_t *dst) 2470Sstevel@tonic-gate { 2480Sstevel@tonic-gate #if defined(__sparc) 2490Sstevel@tonic-gate int i; 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate (void) memset(dst, 0, sizeof (prfpregset_t)); 2520Sstevel@tonic-gate 2530Sstevel@tonic-gate for (i = 0; i < 32; i++) 2540Sstevel@tonic-gate dst->pr_fr.pr_regs[i] = src->pr_fr.pr_regs[i]; 2550Sstevel@tonic-gate 2560Sstevel@tonic-gate /* 2570Sstevel@tonic-gate * We deliberately do not convert pr_qcnt or pr_q because it is a long- 2580Sstevel@tonic-gate * standing /proc bug that this information is not exported, and another 2590Sstevel@tonic-gate * bug further caused these values to be returned as uninitialized data 2600Sstevel@tonic-gate * when the 64-bit kernel exported them for a 32-bit process with en=0. 2610Sstevel@tonic-gate */ 2620Sstevel@tonic-gate dst->pr_filler = src->pr_filler; 2630Sstevel@tonic-gate dst->pr_fsr = src->pr_fsr; 2640Sstevel@tonic-gate dst->pr_q_entrysize = src->pr_q_entrysize; 2650Sstevel@tonic-gate dst->pr_en = src->pr_en; 2660Sstevel@tonic-gate 2670Sstevel@tonic-gate #elif defined(__amd64) 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate struct _fpstate32 *src32 = (struct _fpstate32 *)src; 2700Sstevel@tonic-gate struct fpchip_state *dst64 = (struct fpchip_state *)dst; 2710Sstevel@tonic-gate int i; 2720Sstevel@tonic-gate 2730Sstevel@tonic-gate (void) memcpy(dst64->st, src32->_st, sizeof (src32->_st)); 2740Sstevel@tonic-gate (void) memcpy(dst64->xmm, src32->xmm, sizeof (src32->xmm)); 2750Sstevel@tonic-gate (void) memset((caddr_t)dst64->xmm + sizeof (src32->xmm), 0, 2760Sstevel@tonic-gate sizeof (dst64->xmm) - sizeof (src32->xmm)); 2770Sstevel@tonic-gate dst64->cw = (uint16_t)src32->cw; 2780Sstevel@tonic-gate dst64->sw = (uint16_t)src32->sw; 2790Sstevel@tonic-gate dst64->fop = 0; 2800Sstevel@tonic-gate dst64->rip = src32->ipoff; 2810Sstevel@tonic-gate dst64->rdp = src32->dataoff; 2820Sstevel@tonic-gate dst64->mxcsr = src32->mxcsr; 2830Sstevel@tonic-gate dst64->mxcsr_mask = 0; 2840Sstevel@tonic-gate dst64->status = src32->status; 2850Sstevel@tonic-gate dst64->xstatus = src32->xstatus; 2860Sstevel@tonic-gate 2870Sstevel@tonic-gate /* 2880Sstevel@tonic-gate * Converting from the tag field to the compressed fctw is easy. 2890Sstevel@tonic-gate * If the two tag bits are 3, then the register is empty and we 2900Sstevel@tonic-gate * clear the bit in fctw. Otherwise we set the bit. 2910Sstevel@tonic-gate */ 2920Sstevel@tonic-gate 2930Sstevel@tonic-gate dst64->fctw = 0; 2940Sstevel@tonic-gate for (i = 0; i < 8; i++) 2950Sstevel@tonic-gate if (((src32->tag >> (i * 2)) & 3) != 3) 2960Sstevel@tonic-gate dst64->fctw |= 1 << i; 2970Sstevel@tonic-gate #else 2980Sstevel@tonic-gate #error "unrecognized ISA" 2990Sstevel@tonic-gate #endif 3000Sstevel@tonic-gate } 3010Sstevel@tonic-gate 3020Sstevel@tonic-gate void 3030Sstevel@tonic-gate lwpstatus_32_to_n(const lwpstatus32_t *src, lwpstatus_t *dst) 3040Sstevel@tonic-gate { 3050Sstevel@tonic-gate int i; 3060Sstevel@tonic-gate 3070Sstevel@tonic-gate dst->pr_flags = src->pr_flags; 3080Sstevel@tonic-gate dst->pr_lwpid = src->pr_lwpid; 3090Sstevel@tonic-gate dst->pr_why = src->pr_why; 3100Sstevel@tonic-gate dst->pr_what = src->pr_what; 3110Sstevel@tonic-gate dst->pr_cursig = src->pr_cursig; 3120Sstevel@tonic-gate 3130Sstevel@tonic-gate siginfo_32_to_n(&src->pr_info, &dst->pr_info); 3140Sstevel@tonic-gate 3150Sstevel@tonic-gate dst->pr_lwppend = src->pr_lwppend; 3160Sstevel@tonic-gate dst->pr_lwphold = src->pr_lwphold; 3170Sstevel@tonic-gate 3180Sstevel@tonic-gate sigaction_32_to_n(&src->pr_action, &dst->pr_action); 3190Sstevel@tonic-gate stack_32_to_n(&src->pr_altstack, &dst->pr_altstack); 3200Sstevel@tonic-gate 3210Sstevel@tonic-gate dst->pr_oldcontext = src->pr_oldcontext; 3220Sstevel@tonic-gate dst->pr_syscall = src->pr_syscall; 3230Sstevel@tonic-gate dst->pr_nsysarg = src->pr_nsysarg; 3240Sstevel@tonic-gate dst->pr_errno = src->pr_errno; 3250Sstevel@tonic-gate 3260Sstevel@tonic-gate for (i = 0; i < PRSYSARGS; i++) 3270Sstevel@tonic-gate dst->pr_sysarg[i] = (long)(uint32_t)src->pr_sysarg[i]; 3280Sstevel@tonic-gate 3290Sstevel@tonic-gate dst->pr_rval1 = (long)(uint32_t)src->pr_rval1; 3300Sstevel@tonic-gate dst->pr_rval2 = (long)(uint32_t)src->pr_rval2; 3310Sstevel@tonic-gate 3320Sstevel@tonic-gate (void) memcpy(&dst->pr_clname[0], &src->pr_clname[0], PRCLSZ); 3330Sstevel@tonic-gate timestruc_32_to_n(&src->pr_tstamp, &dst->pr_tstamp); 3340Sstevel@tonic-gate 3350Sstevel@tonic-gate dst->pr_ustack = src->pr_ustack; 3360Sstevel@tonic-gate dst->pr_instr = src->pr_instr; 3370Sstevel@tonic-gate 3380Sstevel@tonic-gate prgregset_32_to_n(src->pr_reg, dst->pr_reg); 3390Sstevel@tonic-gate prfpregset_32_to_n(&src->pr_fpreg, &dst->pr_fpreg); 3400Sstevel@tonic-gate } 3410Sstevel@tonic-gate 3420Sstevel@tonic-gate void 3430Sstevel@tonic-gate pstatus_32_to_n(const pstatus32_t *src, pstatus_t *dst) 3440Sstevel@tonic-gate { 3450Sstevel@tonic-gate dst->pr_flags = src->pr_flags; 3460Sstevel@tonic-gate dst->pr_nlwp = src->pr_nlwp; 3470Sstevel@tonic-gate dst->pr_nzomb = src->pr_nzomb; 3480Sstevel@tonic-gate dst->pr_pid = src->pr_pid; 3490Sstevel@tonic-gate dst->pr_ppid = src->pr_ppid; 3500Sstevel@tonic-gate dst->pr_pgid = src->pr_pgid; 3510Sstevel@tonic-gate dst->pr_sid = src->pr_sid; 3520Sstevel@tonic-gate dst->pr_taskid = src->pr_taskid; 3530Sstevel@tonic-gate dst->pr_projid = src->pr_projid; 3540Sstevel@tonic-gate dst->pr_zoneid = src->pr_zoneid; 3550Sstevel@tonic-gate dst->pr_aslwpid = src->pr_aslwpid; 3560Sstevel@tonic-gate dst->pr_agentid = src->pr_agentid; 3570Sstevel@tonic-gate dst->pr_sigpend = src->pr_sigpend; 3580Sstevel@tonic-gate dst->pr_brkbase = src->pr_brkbase; 3590Sstevel@tonic-gate dst->pr_brksize = src->pr_brksize; 3600Sstevel@tonic-gate dst->pr_stkbase = src->pr_stkbase; 3610Sstevel@tonic-gate dst->pr_stksize = src->pr_stksize; 3620Sstevel@tonic-gate 3630Sstevel@tonic-gate timestruc_32_to_n(&src->pr_utime, &dst->pr_utime); 3640Sstevel@tonic-gate timestruc_32_to_n(&src->pr_stime, &dst->pr_stime); 3650Sstevel@tonic-gate timestruc_32_to_n(&src->pr_cutime, &dst->pr_cutime); 3660Sstevel@tonic-gate timestruc_32_to_n(&src->pr_cstime, &dst->pr_cstime); 3670Sstevel@tonic-gate 3680Sstevel@tonic-gate dst->pr_sigtrace = src->pr_sigtrace; 3690Sstevel@tonic-gate dst->pr_flttrace = src->pr_flttrace; 3700Sstevel@tonic-gate dst->pr_sysentry = src->pr_sysentry; 3710Sstevel@tonic-gate dst->pr_sysexit = src->pr_sysexit; 3720Sstevel@tonic-gate dst->pr_dmodel = src->pr_dmodel; 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate lwpstatus_32_to_n(&src->pr_lwp, &dst->pr_lwp); 3750Sstevel@tonic-gate } 3760Sstevel@tonic-gate 3770Sstevel@tonic-gate void 3780Sstevel@tonic-gate lwpsinfo_32_to_n(const lwpsinfo32_t *src, lwpsinfo_t *dst) 3790Sstevel@tonic-gate { 3800Sstevel@tonic-gate dst->pr_flag = src->pr_flag; 3810Sstevel@tonic-gate dst->pr_lwpid = src->pr_lwpid; 3820Sstevel@tonic-gate dst->pr_addr = src->pr_addr; 3830Sstevel@tonic-gate dst->pr_wchan = src->pr_wchan; 3840Sstevel@tonic-gate dst->pr_stype = src->pr_stype; 3850Sstevel@tonic-gate dst->pr_state = src->pr_state; 3860Sstevel@tonic-gate dst->pr_sname = src->pr_sname; 3870Sstevel@tonic-gate dst->pr_nice = src->pr_nice; 3880Sstevel@tonic-gate dst->pr_syscall = src->pr_syscall; 3890Sstevel@tonic-gate dst->pr_oldpri = src->pr_oldpri; 3900Sstevel@tonic-gate dst->pr_cpu = src->pr_cpu; 3910Sstevel@tonic-gate dst->pr_pri = src->pr_pri; 3920Sstevel@tonic-gate dst->pr_pctcpu = src->pr_pctcpu; 3930Sstevel@tonic-gate 3940Sstevel@tonic-gate timestruc_32_to_n(&src->pr_start, &dst->pr_start); 3950Sstevel@tonic-gate timestruc_32_to_n(&src->pr_time, &dst->pr_time); 3960Sstevel@tonic-gate 3970Sstevel@tonic-gate (void) memcpy(&dst->pr_clname[0], &src->pr_clname[0], PRCLSZ); 3980Sstevel@tonic-gate (void) memcpy(&dst->pr_name[0], &src->pr_name[0], PRFNSZ); 3990Sstevel@tonic-gate 4000Sstevel@tonic-gate dst->pr_onpro = src->pr_onpro; 4010Sstevel@tonic-gate dst->pr_bindpro = src->pr_bindpro; 4020Sstevel@tonic-gate dst->pr_bindpset = src->pr_bindpset; 403*2685Sakolb dst->pr_lgrp = src->pr_lgrp; 4040Sstevel@tonic-gate } 4050Sstevel@tonic-gate 4060Sstevel@tonic-gate void 4070Sstevel@tonic-gate psinfo_32_to_n(const psinfo32_t *src, psinfo_t *dst) 4080Sstevel@tonic-gate { 4090Sstevel@tonic-gate dst->pr_flag = src->pr_flag; 4100Sstevel@tonic-gate dst->pr_nlwp = src->pr_nlwp; 4110Sstevel@tonic-gate dst->pr_nzomb = src->pr_nzomb; 4120Sstevel@tonic-gate dst->pr_pid = src->pr_pid; 4130Sstevel@tonic-gate dst->pr_pgid = src->pr_pgid; 4140Sstevel@tonic-gate dst->pr_sid = src->pr_sid; 4150Sstevel@tonic-gate dst->pr_taskid = src->pr_taskid; 4160Sstevel@tonic-gate dst->pr_projid = src->pr_projid; 4170Sstevel@tonic-gate dst->pr_zoneid = src->pr_zoneid; 4180Sstevel@tonic-gate dst->pr_uid = src->pr_uid; 4190Sstevel@tonic-gate dst->pr_euid = src->pr_euid; 4200Sstevel@tonic-gate dst->pr_gid = src->pr_gid; 4210Sstevel@tonic-gate dst->pr_egid = src->pr_egid; 4220Sstevel@tonic-gate dst->pr_addr = src->pr_addr; 4230Sstevel@tonic-gate dst->pr_size = src->pr_size; 4240Sstevel@tonic-gate dst->pr_rssize = src->pr_rssize; 4250Sstevel@tonic-gate 4260Sstevel@tonic-gate dst->pr_ttydev = prexpldev(src->pr_ttydev); 4270Sstevel@tonic-gate 4280Sstevel@tonic-gate dst->pr_pctcpu = src->pr_pctcpu; 4290Sstevel@tonic-gate dst->pr_pctmem = src->pr_pctmem; 4300Sstevel@tonic-gate 4310Sstevel@tonic-gate timestruc_32_to_n(&src->pr_start, &dst->pr_start); 4320Sstevel@tonic-gate timestruc_32_to_n(&src->pr_time, &dst->pr_time); 4330Sstevel@tonic-gate timestruc_32_to_n(&src->pr_ctime, &dst->pr_ctime); 4340Sstevel@tonic-gate 4350Sstevel@tonic-gate (void) memcpy(&dst->pr_fname[0], &src->pr_fname[0], PRFNSZ); 4360Sstevel@tonic-gate (void) memcpy(&dst->pr_psargs[0], &src->pr_psargs[0], PRARGSZ); 4370Sstevel@tonic-gate 4380Sstevel@tonic-gate dst->pr_wstat = src->pr_wstat; 4390Sstevel@tonic-gate dst->pr_argc = src->pr_argc; 4400Sstevel@tonic-gate dst->pr_argv = src->pr_argv; 4410Sstevel@tonic-gate dst->pr_envp = src->pr_envp; 4420Sstevel@tonic-gate dst->pr_dmodel = src->pr_dmodel; 4430Sstevel@tonic-gate 4440Sstevel@tonic-gate lwpsinfo_32_to_n(&src->pr_lwp, &dst->pr_lwp); 4450Sstevel@tonic-gate } 4460Sstevel@tonic-gate 4470Sstevel@tonic-gate void 4480Sstevel@tonic-gate timestruc_n_to_32(const timestruc_t *src, timestruc32_t *dst) 4490Sstevel@tonic-gate { 4500Sstevel@tonic-gate dst->tv_sec = (time32_t)src->tv_sec; 4510Sstevel@tonic-gate dst->tv_nsec = (int32_t)src->tv_nsec; 4520Sstevel@tonic-gate } 4530Sstevel@tonic-gate 4540Sstevel@tonic-gate void 4550Sstevel@tonic-gate stack_n_to_32(const stack_t *src, stack32_t *dst) 4560Sstevel@tonic-gate { 4570Sstevel@tonic-gate dst->ss_sp = (caddr32_t)(uintptr_t)src->ss_sp; 4580Sstevel@tonic-gate dst->ss_size = src->ss_size; 4590Sstevel@tonic-gate dst->ss_flags = src->ss_flags; 4600Sstevel@tonic-gate } 4610Sstevel@tonic-gate 4620Sstevel@tonic-gate void 4630Sstevel@tonic-gate sigaction_n_to_32(const struct sigaction *src, struct sigaction32 *dst) 4640Sstevel@tonic-gate { 4650Sstevel@tonic-gate (void) memset(dst, 0, sizeof (struct sigaction32)); 4660Sstevel@tonic-gate dst->sa_flags = src->sa_flags; 4670Sstevel@tonic-gate dst->sa_handler = (caddr32_t)(uintptr_t)src->sa_handler; 4680Sstevel@tonic-gate (void) memcpy(&dst->sa_mask, &src->sa_mask, sizeof (dst->sa_mask)); 4690Sstevel@tonic-gate } 4700Sstevel@tonic-gate 4710Sstevel@tonic-gate void 4720Sstevel@tonic-gate siginfo_n_to_32(const siginfo_t *src, siginfo32_t *dst) 4730Sstevel@tonic-gate { 4740Sstevel@tonic-gate (void) memset(dst, 0, sizeof (siginfo32_t)); 4750Sstevel@tonic-gate 4760Sstevel@tonic-gate /* 4770Sstevel@tonic-gate * The absolute minimum content is si_signo and si_code. 4780Sstevel@tonic-gate */ 4790Sstevel@tonic-gate dst->si_signo = src->si_signo; 4800Sstevel@tonic-gate if ((dst->si_code = src->si_code) == SI_NOINFO) 4810Sstevel@tonic-gate return; 4820Sstevel@tonic-gate 4830Sstevel@tonic-gate /* 4840Sstevel@tonic-gate * A siginfo generated by user level is structured 4850Sstevel@tonic-gate * differently from one generated by the kernel. 4860Sstevel@tonic-gate */ 4870Sstevel@tonic-gate if (SI_FROMUSER(src)) { 4880Sstevel@tonic-gate dst->si_pid = src->si_pid; 4890Sstevel@tonic-gate dst->si_ctid = src->si_ctid; 4900Sstevel@tonic-gate dst->si_zoneid = src->si_zoneid; 4910Sstevel@tonic-gate dst->si_uid = src->si_uid; 4920Sstevel@tonic-gate if (SI_CANQUEUE(src->si_code)) { 4930Sstevel@tonic-gate dst->si_value.sival_int = 4940Sstevel@tonic-gate (int32_t)src->si_value.sival_int; 4950Sstevel@tonic-gate } 4960Sstevel@tonic-gate return; 4970Sstevel@tonic-gate } 4980Sstevel@tonic-gate 4990Sstevel@tonic-gate dst->si_errno = src->si_errno; 5000Sstevel@tonic-gate 5010Sstevel@tonic-gate switch (src->si_signo) { 5020Sstevel@tonic-gate default: 5030Sstevel@tonic-gate dst->si_pid = src->si_pid; 5040Sstevel@tonic-gate dst->si_ctid = src->si_ctid; 5050Sstevel@tonic-gate dst->si_zoneid = src->si_zoneid; 5060Sstevel@tonic-gate dst->si_uid = src->si_uid; 5070Sstevel@tonic-gate dst->si_value.sival_int = 5080Sstevel@tonic-gate (int32_t)src->si_value.sival_int; 5090Sstevel@tonic-gate break; 5100Sstevel@tonic-gate case SIGCLD: 5110Sstevel@tonic-gate dst->si_pid = src->si_pid; 5120Sstevel@tonic-gate dst->si_ctid = src->si_ctid; 5130Sstevel@tonic-gate dst->si_zoneid = src->si_zoneid; 5140Sstevel@tonic-gate dst->si_status = src->si_status; 5150Sstevel@tonic-gate dst->si_stime = src->si_stime; 5160Sstevel@tonic-gate dst->si_utime = src->si_utime; 5170Sstevel@tonic-gate break; 5180Sstevel@tonic-gate case SIGSEGV: 5190Sstevel@tonic-gate case SIGBUS: 5200Sstevel@tonic-gate case SIGILL: 5210Sstevel@tonic-gate case SIGTRAP: 5220Sstevel@tonic-gate case SIGFPE: 5230Sstevel@tonic-gate case SIGEMT: 5240Sstevel@tonic-gate dst->si_addr = (caddr32_t)(uintptr_t)src->si_addr; 5250Sstevel@tonic-gate dst->si_trapno = src->si_trapno; 5260Sstevel@tonic-gate dst->si_pc = (caddr32_t)(uintptr_t)src->si_pc; 5270Sstevel@tonic-gate break; 5280Sstevel@tonic-gate case SIGPOLL: 5290Sstevel@tonic-gate case SIGXFSZ: 5300Sstevel@tonic-gate dst->si_fd = src->si_fd; 5310Sstevel@tonic-gate dst->si_band = src->si_band; 5320Sstevel@tonic-gate break; 5330Sstevel@tonic-gate case SIGPROF: 5340Sstevel@tonic-gate dst->si_faddr = (caddr32_t)(uintptr_t)src->si_faddr; 5350Sstevel@tonic-gate dst->si_tstamp.tv_sec = src->si_tstamp.tv_sec; 5360Sstevel@tonic-gate dst->si_tstamp.tv_nsec = src->si_tstamp.tv_nsec; 5370Sstevel@tonic-gate dst->si_syscall = src->si_syscall; 5380Sstevel@tonic-gate dst->si_nsysarg = src->si_nsysarg; 5390Sstevel@tonic-gate dst->si_fault = src->si_fault; 5400Sstevel@tonic-gate break; 5410Sstevel@tonic-gate } 5420Sstevel@tonic-gate } 5430Sstevel@tonic-gate 5440Sstevel@tonic-gate void 5450Sstevel@tonic-gate auxv_n_to_32(const auxv_t *src, auxv32_t *dst) 5460Sstevel@tonic-gate { 5470Sstevel@tonic-gate dst->a_type = src->a_type; 5480Sstevel@tonic-gate dst->a_un.a_ptr = (caddr32_t)(uintptr_t)src->a_un.a_ptr; 5490Sstevel@tonic-gate } 5500Sstevel@tonic-gate 5510Sstevel@tonic-gate void 5520Sstevel@tonic-gate prgregset_n_to_32(const prgreg_t *src, prgreg32_t *dst) 5530Sstevel@tonic-gate { 5540Sstevel@tonic-gate #ifdef __amd64 5550Sstevel@tonic-gate (void) memset(dst, 0, NPRGREG32 * sizeof (prgreg32_t)); 5560Sstevel@tonic-gate dst[GS] = src[REG_GS]; 5570Sstevel@tonic-gate dst[FS] = src[REG_FS]; 5580Sstevel@tonic-gate dst[DS] = src[REG_DS]; 5590Sstevel@tonic-gate dst[ES] = src[REG_ES]; 5600Sstevel@tonic-gate dst[EDI] = src[REG_RDI]; 5610Sstevel@tonic-gate dst[ESI] = src[REG_RSI]; 5620Sstevel@tonic-gate dst[EBP] = src[REG_RBP]; 5630Sstevel@tonic-gate dst[EBX] = src[REG_RBX]; 5640Sstevel@tonic-gate dst[EDX] = src[REG_RDX]; 5650Sstevel@tonic-gate dst[ECX] = src[REG_RCX]; 5660Sstevel@tonic-gate dst[EAX] = src[REG_RAX]; 5670Sstevel@tonic-gate dst[TRAPNO] = src[REG_TRAPNO]; 5680Sstevel@tonic-gate dst[ERR] = src[REG_ERR]; 5690Sstevel@tonic-gate dst[EIP] = src[REG_RIP]; 5700Sstevel@tonic-gate dst[CS] = src[REG_CS]; 5710Sstevel@tonic-gate dst[EFL] = src[REG_RFL]; 5720Sstevel@tonic-gate dst[UESP] = src[REG_RSP]; 5730Sstevel@tonic-gate dst[SS] = src[REG_SS]; 5740Sstevel@tonic-gate #else 5750Sstevel@tonic-gate int i; 5760Sstevel@tonic-gate 5770Sstevel@tonic-gate for (i = 0; i < NPRGREG; i++) 5780Sstevel@tonic-gate dst[i] = (prgreg32_t)src[i]; 5790Sstevel@tonic-gate #endif 5800Sstevel@tonic-gate } 5810Sstevel@tonic-gate 5820Sstevel@tonic-gate void 5830Sstevel@tonic-gate prfpregset_n_to_32(const prfpregset_t *src, prfpregset32_t *dst) 5840Sstevel@tonic-gate { 5850Sstevel@tonic-gate #if defined(__sparc) 5860Sstevel@tonic-gate int i; 5870Sstevel@tonic-gate 5880Sstevel@tonic-gate (void) memset(dst, 0, sizeof (prfpregset32_t)); 5890Sstevel@tonic-gate 5900Sstevel@tonic-gate for (i = 0; i < 32; i++) 5910Sstevel@tonic-gate dst->pr_fr.pr_regs[i] = src->pr_fr.pr_regs[i]; 5920Sstevel@tonic-gate 5930Sstevel@tonic-gate dst->pr_filler = src->pr_filler; 5940Sstevel@tonic-gate dst->pr_fsr = src->pr_fsr; 5950Sstevel@tonic-gate dst->pr_q_entrysize = src->pr_q_entrysize; 5960Sstevel@tonic-gate dst->pr_en = src->pr_en; 5970Sstevel@tonic-gate 5980Sstevel@tonic-gate #elif defined(__amd64) 5990Sstevel@tonic-gate 6000Sstevel@tonic-gate struct _fpstate32 *dst32 = (struct _fpstate32 *)dst; 6010Sstevel@tonic-gate struct fpchip_state *src64 = (struct fpchip_state *)src; 6020Sstevel@tonic-gate uint32_t top; 6030Sstevel@tonic-gate int i; 6040Sstevel@tonic-gate 6050Sstevel@tonic-gate (void) memcpy(dst32->_st, src64->st, sizeof (dst32->_st)); 6060Sstevel@tonic-gate (void) memcpy(dst32->xmm, src64->xmm, sizeof (dst32->xmm)); 6070Sstevel@tonic-gate dst32->cw = src64->cw; 6080Sstevel@tonic-gate dst32->sw = src64->sw; 6090Sstevel@tonic-gate dst32->ipoff = (unsigned int)src64->rip; 6100Sstevel@tonic-gate dst32->cssel = 0; 6110Sstevel@tonic-gate dst32->dataoff = (unsigned int)src64->rdp; 6120Sstevel@tonic-gate dst32->datasel = 0; 6130Sstevel@tonic-gate dst32->status = src64->status; 6140Sstevel@tonic-gate dst32->mxcsr = src64->mxcsr; 6150Sstevel@tonic-gate dst32->xstatus = src64->xstatus; 6160Sstevel@tonic-gate 6170Sstevel@tonic-gate /* 6180Sstevel@tonic-gate * AMD64 stores the tag in a compressed form. It is 6190Sstevel@tonic-gate * necessary to extract the original 2-bit tag value. 6200Sstevel@tonic-gate * See AMD64 Architecture Programmer's Manual Volume 2: 6210Sstevel@tonic-gate * System Programming, Chapter 11. 6220Sstevel@tonic-gate */ 6230Sstevel@tonic-gate 6240Sstevel@tonic-gate top = (src64->sw & FPS_TOP) >> 11; 6250Sstevel@tonic-gate dst32->tag = 0; 6260Sstevel@tonic-gate for (i = 0; i < 8; i++) { 6270Sstevel@tonic-gate /* 6280Sstevel@tonic-gate * Recall that we need to use the current TOP-of-stack value to 6290Sstevel@tonic-gate * associate the _st[] index back to a physical register number, 6300Sstevel@tonic-gate * since tag word indices are physical register numbers. Then 6310Sstevel@tonic-gate * to get the tag value, we shift over two bits for each tag 6320Sstevel@tonic-gate * index, and then grab the bottom two bits. 6330Sstevel@tonic-gate */ 6340Sstevel@tonic-gate uint_t tag_index = (i + top) & 7; 6350Sstevel@tonic-gate uint_t tag_fctw = (src64->fctw >> tag_index) & 1; 6360Sstevel@tonic-gate uint_t tag_value; 6370Sstevel@tonic-gate uint_t exp; 6380Sstevel@tonic-gate 6390Sstevel@tonic-gate /* 6400Sstevel@tonic-gate * Union for overlaying _fpreg structure on to quad-precision 6410Sstevel@tonic-gate * floating-point value (long double). 6420Sstevel@tonic-gate */ 6430Sstevel@tonic-gate union { 6440Sstevel@tonic-gate struct _fpreg reg; 6450Sstevel@tonic-gate long double ld; 6460Sstevel@tonic-gate } fpru; 6470Sstevel@tonic-gate 6480Sstevel@tonic-gate fpru.ld = src64->st[i].__fpr_pad._q; 6490Sstevel@tonic-gate exp = fpru.reg.exponent & 0x7fff; 6500Sstevel@tonic-gate 6510Sstevel@tonic-gate if (tag_fctw == 0) { 6520Sstevel@tonic-gate tag_value = 3; /* empty */ 6530Sstevel@tonic-gate } else if (exp == 0) { 6540Sstevel@tonic-gate if (fpru.reg.significand[0] == 0 && 6550Sstevel@tonic-gate fpru.reg.significand[1] == 0 && 6560Sstevel@tonic-gate fpru.reg.significand[2] == 0 && 6570Sstevel@tonic-gate fpru.reg.significand[3] == 0) 6580Sstevel@tonic-gate tag_value = 1; /* zero */ 6590Sstevel@tonic-gate else 6600Sstevel@tonic-gate tag_value = 2; /* special: denormal */ 6610Sstevel@tonic-gate } else if (exp == 0x7fff) { 6620Sstevel@tonic-gate tag_value = 2; /* special: infinity or NaN */ 6630Sstevel@tonic-gate } else if (fpru.reg.significand[3] & 0x8000) { 6640Sstevel@tonic-gate tag_value = 0; /* valid */ 6650Sstevel@tonic-gate } else { 6660Sstevel@tonic-gate tag_value = 2; /* special: unnormal */ 6670Sstevel@tonic-gate } 6680Sstevel@tonic-gate dst32->tag |= tag_value << (tag_index * 2); 6690Sstevel@tonic-gate } 6700Sstevel@tonic-gate #else 6710Sstevel@tonic-gate #error "unrecognized ISA" 6720Sstevel@tonic-gate #endif 6730Sstevel@tonic-gate } 6740Sstevel@tonic-gate 6750Sstevel@tonic-gate void 6760Sstevel@tonic-gate lwpstatus_n_to_32(const lwpstatus_t *src, lwpstatus32_t *dst) 6770Sstevel@tonic-gate { 6780Sstevel@tonic-gate int i; 6790Sstevel@tonic-gate 6800Sstevel@tonic-gate dst->pr_flags = src->pr_flags; 6810Sstevel@tonic-gate dst->pr_lwpid = src->pr_lwpid; 6820Sstevel@tonic-gate dst->pr_why = src->pr_why; 6830Sstevel@tonic-gate dst->pr_what = src->pr_what; 6840Sstevel@tonic-gate dst->pr_cursig = src->pr_cursig; 6850Sstevel@tonic-gate 6860Sstevel@tonic-gate siginfo_n_to_32(&src->pr_info, &dst->pr_info); 6870Sstevel@tonic-gate 6880Sstevel@tonic-gate dst->pr_lwppend = src->pr_lwppend; 6890Sstevel@tonic-gate dst->pr_lwphold = src->pr_lwphold; 6900Sstevel@tonic-gate 6910Sstevel@tonic-gate sigaction_n_to_32(&src->pr_action, &dst->pr_action); 6920Sstevel@tonic-gate stack_n_to_32(&src->pr_altstack, &dst->pr_altstack); 6930Sstevel@tonic-gate 6940Sstevel@tonic-gate dst->pr_oldcontext = (caddr32_t)src->pr_oldcontext; 6950Sstevel@tonic-gate dst->pr_syscall = src->pr_syscall; 6960Sstevel@tonic-gate dst->pr_nsysarg = src->pr_nsysarg; 6970Sstevel@tonic-gate dst->pr_errno = src->pr_errno; 6980Sstevel@tonic-gate 6990Sstevel@tonic-gate for (i = 0; i < PRSYSARGS; i++) 7000Sstevel@tonic-gate dst->pr_sysarg[i] = (int32_t)src->pr_sysarg[i]; 7010Sstevel@tonic-gate 7020Sstevel@tonic-gate dst->pr_rval1 = (int32_t)src->pr_rval1; 7030Sstevel@tonic-gate dst->pr_rval2 = (int32_t)src->pr_rval2; 7040Sstevel@tonic-gate 7050Sstevel@tonic-gate (void) memcpy(&dst->pr_clname[0], &src->pr_clname[0], PRCLSZ); 7060Sstevel@tonic-gate timestruc_n_to_32(&src->pr_tstamp, &dst->pr_tstamp); 7070Sstevel@tonic-gate 7080Sstevel@tonic-gate dst->pr_ustack = (caddr32_t)src->pr_ustack; 7090Sstevel@tonic-gate dst->pr_instr = src->pr_instr; 7100Sstevel@tonic-gate 7110Sstevel@tonic-gate prgregset_n_to_32(src->pr_reg, dst->pr_reg); 7120Sstevel@tonic-gate prfpregset_n_to_32(&src->pr_fpreg, &dst->pr_fpreg); 7130Sstevel@tonic-gate } 7140Sstevel@tonic-gate 7150Sstevel@tonic-gate void 7160Sstevel@tonic-gate pstatus_n_to_32(const pstatus_t *src, pstatus32_t *dst) 7170Sstevel@tonic-gate { 7180Sstevel@tonic-gate dst->pr_flags = src->pr_flags; 7190Sstevel@tonic-gate dst->pr_nlwp = src->pr_nlwp; 7200Sstevel@tonic-gate dst->pr_nzomb = src->pr_nzomb; 7210Sstevel@tonic-gate dst->pr_pid = (pid32_t)src->pr_pid; 7220Sstevel@tonic-gate dst->pr_ppid = (pid32_t)src->pr_ppid; 7230Sstevel@tonic-gate dst->pr_pgid = (pid32_t)src->pr_pgid; 7240Sstevel@tonic-gate dst->pr_sid = (pid32_t)src->pr_sid; 7250Sstevel@tonic-gate dst->pr_taskid = (id32_t)src->pr_taskid; 7260Sstevel@tonic-gate dst->pr_projid = (id32_t)src->pr_projid; 7270Sstevel@tonic-gate dst->pr_zoneid = (id32_t)src->pr_zoneid; 7280Sstevel@tonic-gate dst->pr_aslwpid = (id32_t)src->pr_aslwpid; 7290Sstevel@tonic-gate dst->pr_agentid = (id32_t)src->pr_agentid; 7300Sstevel@tonic-gate dst->pr_sigpend = src->pr_sigpend; 7310Sstevel@tonic-gate dst->pr_brkbase = (caddr32_t)src->pr_brkbase; 7320Sstevel@tonic-gate dst->pr_brksize = (size32_t)src->pr_brksize; 7330Sstevel@tonic-gate dst->pr_stkbase = (caddr32_t)src->pr_stkbase; 7340Sstevel@tonic-gate dst->pr_stksize = (size32_t)src->pr_stksize; 7350Sstevel@tonic-gate 7360Sstevel@tonic-gate timestruc_n_to_32(&src->pr_utime, &dst->pr_utime); 7370Sstevel@tonic-gate timestruc_n_to_32(&src->pr_stime, &dst->pr_stime); 7380Sstevel@tonic-gate timestruc_n_to_32(&src->pr_cutime, &dst->pr_cutime); 7390Sstevel@tonic-gate timestruc_n_to_32(&src->pr_cstime, &dst->pr_cstime); 7400Sstevel@tonic-gate 7410Sstevel@tonic-gate dst->pr_sigtrace = src->pr_sigtrace; 7420Sstevel@tonic-gate dst->pr_flttrace = src->pr_flttrace; 7430Sstevel@tonic-gate dst->pr_sysentry = src->pr_sysentry; 7440Sstevel@tonic-gate dst->pr_sysexit = src->pr_sysexit; 7450Sstevel@tonic-gate dst->pr_dmodel = src->pr_dmodel; 7460Sstevel@tonic-gate 7470Sstevel@tonic-gate lwpstatus_n_to_32(&src->pr_lwp, &dst->pr_lwp); 7480Sstevel@tonic-gate } 7490Sstevel@tonic-gate 7500Sstevel@tonic-gate void 7510Sstevel@tonic-gate lwpsinfo_n_to_32(const lwpsinfo_t *src, lwpsinfo32_t *dst) 7520Sstevel@tonic-gate { 7530Sstevel@tonic-gate dst->pr_flag = src->pr_flag; 7540Sstevel@tonic-gate dst->pr_lwpid = (id32_t)src->pr_lwpid; 7550Sstevel@tonic-gate dst->pr_addr = (caddr32_t)src->pr_addr; 7560Sstevel@tonic-gate dst->pr_wchan = (caddr32_t)src->pr_wchan; 7570Sstevel@tonic-gate dst->pr_stype = src->pr_stype; 7580Sstevel@tonic-gate dst->pr_state = src->pr_state; 7590Sstevel@tonic-gate dst->pr_sname = src->pr_sname; 7600Sstevel@tonic-gate dst->pr_nice = src->pr_nice; 7610Sstevel@tonic-gate dst->pr_syscall = src->pr_syscall; 7620Sstevel@tonic-gate dst->pr_oldpri = src->pr_oldpri; 7630Sstevel@tonic-gate dst->pr_cpu = src->pr_cpu; 7640Sstevel@tonic-gate dst->pr_pri = src->pr_pri; 7650Sstevel@tonic-gate dst->pr_pctcpu = src->pr_pctcpu; 7660Sstevel@tonic-gate 7670Sstevel@tonic-gate timestruc_n_to_32(&src->pr_start, &dst->pr_start); 7680Sstevel@tonic-gate timestruc_n_to_32(&src->pr_time, &dst->pr_time); 7690Sstevel@tonic-gate 7700Sstevel@tonic-gate (void) memcpy(&dst->pr_clname[0], &src->pr_clname[0], PRCLSZ); 7710Sstevel@tonic-gate (void) memcpy(&dst->pr_name[0], &src->pr_name[0], PRFNSZ); 7720Sstevel@tonic-gate 7730Sstevel@tonic-gate dst->pr_onpro = src->pr_onpro; 7740Sstevel@tonic-gate dst->pr_bindpro = src->pr_bindpro; 7750Sstevel@tonic-gate dst->pr_bindpset = src->pr_bindpset; 776*2685Sakolb dst->pr_lgrp = src->pr_lgrp; 7770Sstevel@tonic-gate } 7780Sstevel@tonic-gate 7790Sstevel@tonic-gate void 7800Sstevel@tonic-gate psinfo_n_to_32(const psinfo_t *src, psinfo32_t *dst) 7810Sstevel@tonic-gate { 7820Sstevel@tonic-gate dst->pr_flag = src->pr_flag; 7830Sstevel@tonic-gate dst->pr_nlwp = src->pr_nlwp; 7840Sstevel@tonic-gate dst->pr_nzomb = src->pr_nzomb; 7850Sstevel@tonic-gate dst->pr_pid = (pid32_t)src->pr_pid; 7860Sstevel@tonic-gate dst->pr_pgid = (pid32_t)src->pr_pgid; 7870Sstevel@tonic-gate dst->pr_sid = (pid32_t)src->pr_sid; 7880Sstevel@tonic-gate dst->pr_taskid = (id32_t)src->pr_taskid; 7890Sstevel@tonic-gate dst->pr_projid = (id32_t)src->pr_projid; 7900Sstevel@tonic-gate dst->pr_zoneid = (id32_t)src->pr_zoneid; 7910Sstevel@tonic-gate dst->pr_uid = (uid32_t)src->pr_uid; 7920Sstevel@tonic-gate dst->pr_euid = (uid32_t)src->pr_euid; 7930Sstevel@tonic-gate dst->pr_gid = (gid32_t)src->pr_gid; 7940Sstevel@tonic-gate dst->pr_egid = (gid32_t)src->pr_egid; 7950Sstevel@tonic-gate dst->pr_addr = (caddr32_t)src->pr_addr; 7960Sstevel@tonic-gate dst->pr_size = (size32_t)src->pr_size; 7970Sstevel@tonic-gate dst->pr_rssize = (size32_t)src->pr_rssize; 7980Sstevel@tonic-gate 7990Sstevel@tonic-gate dst->pr_ttydev = prcmpldev(src->pr_ttydev); 8000Sstevel@tonic-gate 8010Sstevel@tonic-gate dst->pr_pctcpu = src->pr_pctcpu; 8020Sstevel@tonic-gate dst->pr_pctmem = src->pr_pctmem; 8030Sstevel@tonic-gate 8040Sstevel@tonic-gate timestruc_n_to_32(&src->pr_start, &dst->pr_start); 8050Sstevel@tonic-gate timestruc_n_to_32(&src->pr_time, &dst->pr_time); 8060Sstevel@tonic-gate timestruc_n_to_32(&src->pr_ctime, &dst->pr_ctime); 8070Sstevel@tonic-gate 8080Sstevel@tonic-gate (void) memcpy(&dst->pr_fname[0], &src->pr_fname[0], PRFNSZ); 8090Sstevel@tonic-gate (void) memcpy(&dst->pr_psargs[0], &src->pr_psargs[0], PRARGSZ); 8100Sstevel@tonic-gate 8110Sstevel@tonic-gate dst->pr_wstat = src->pr_wstat; 8120Sstevel@tonic-gate dst->pr_argc = src->pr_argc; 8130Sstevel@tonic-gate dst->pr_argv = (caddr32_t)src->pr_argv; 8140Sstevel@tonic-gate dst->pr_envp = (caddr32_t)src->pr_envp; 8150Sstevel@tonic-gate dst->pr_dmodel = src->pr_dmodel; 8160Sstevel@tonic-gate 8170Sstevel@tonic-gate lwpsinfo_n_to_32(&src->pr_lwp, &dst->pr_lwp); 8180Sstevel@tonic-gate } 8190Sstevel@tonic-gate 8200Sstevel@tonic-gate 8210Sstevel@tonic-gate #endif /* _LP64 */ 822