17c478bd9Sstevel@tonic-gate/* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*28406508Ssudheer * Common Development and Distribution License (the "License"). 6*28406508Ssudheer * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate/* 22*28406508Ssudheer * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate#pragma ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 297c478bd9Sstevel@tonic-gate#include <sys/dtrace_impl.h> 307c478bd9Sstevel@tonic-gate#else 317c478bd9Sstevel@tonic-gate#include <sys/asm_linkage.h> 327c478bd9Sstevel@tonic-gate#include <sys/privregs.h> 337c478bd9Sstevel@tonic-gate#include <sys/fsr.h> 347c478bd9Sstevel@tonic-gate#include <sys/asi.h> 35*28406508Ssudheer#include "assym.h" 367c478bd9Sstevel@tonic-gate#endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gateint 417c478bd9Sstevel@tonic-gatedtrace_getipl(void) 427c478bd9Sstevel@tonic-gate{ return (0); } 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate#else /* lint */ 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate ENTRY_NP(dtrace_getipl) 477c478bd9Sstevel@tonic-gate retl 487c478bd9Sstevel@tonic-gate rdpr %pil, %o0 497c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_getipl) 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate#endif /* lint */ 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gateuint_t 567c478bd9Sstevel@tonic-gatedtrace_getotherwin(void) 577c478bd9Sstevel@tonic-gate{ return (0); } 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate#else /* lint */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate ENTRY_NP(dtrace_getotherwin) 627c478bd9Sstevel@tonic-gate retl 637c478bd9Sstevel@tonic-gate rdpr %otherwin, %o0 647c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_getotherwin) 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate#endif /* lint */ 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gateuint_t 717c478bd9Sstevel@tonic-gatedtrace_getfprs(void) 727c478bd9Sstevel@tonic-gate{ return (0); } 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate#else /* lint */ 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate ENTRY_NP(dtrace_getfprs) 777c478bd9Sstevel@tonic-gate retl 787c478bd9Sstevel@tonic-gate rd %fprs, %o0 797c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_getfprs) 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate#endif /* lint */ 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 867c478bd9Sstevel@tonic-gatevoid 877c478bd9Sstevel@tonic-gatedtrace_getfsr(uint64_t *val) 887c478bd9Sstevel@tonic-gate{} 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate#else /* lint */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate ENTRY_NP(dtrace_getfsr) 937c478bd9Sstevel@tonic-gate rdpr %pstate, %o1 947c478bd9Sstevel@tonic-gate andcc %o1, PSTATE_PEF, %g0 957c478bd9Sstevel@tonic-gate bz,pn %xcc, 1f 967c478bd9Sstevel@tonic-gate nop 977c478bd9Sstevel@tonic-gate rd %fprs, %o1 987c478bd9Sstevel@tonic-gate andcc %o1, FPRS_FEF, %g0 997c478bd9Sstevel@tonic-gate bz,pn %xcc, 1f 1007c478bd9Sstevel@tonic-gate nop 1017c478bd9Sstevel@tonic-gate retl 1027c478bd9Sstevel@tonic-gate stx %fsr, [%o0] 1037c478bd9Sstevel@tonic-gate1: 1047c478bd9Sstevel@tonic-gate retl 1057c478bd9Sstevel@tonic-gate stx %g0, [%o0] 1067c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_getfsr) 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate#endif /* lint */ 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gategreg_t 1137c478bd9Sstevel@tonic-gatedtrace_getfp(void) 1147c478bd9Sstevel@tonic-gate{ return (0); } 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate#else /* lint */ 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate ENTRY_NP(dtrace_getfp) 1197c478bd9Sstevel@tonic-gate retl 1207c478bd9Sstevel@tonic-gate mov %fp, %o0 1217c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_getfp) 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate#endif /* lint */ 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gatevoid 1287c478bd9Sstevel@tonic-gatedtrace_flush_user_windows(void) 1297c478bd9Sstevel@tonic-gate{} 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate#else 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate ENTRY_NP(dtrace_flush_user_windows) 1347c478bd9Sstevel@tonic-gate rdpr %otherwin, %g1 1357c478bd9Sstevel@tonic-gate brz %g1, 3f 1367c478bd9Sstevel@tonic-gate clr %g2 1377c478bd9Sstevel@tonic-gate1: 1387c478bd9Sstevel@tonic-gate save %sp, -WINDOWSIZE, %sp 1397c478bd9Sstevel@tonic-gate rdpr %otherwin, %g1 1407c478bd9Sstevel@tonic-gate brnz %g1, 1b 1417c478bd9Sstevel@tonic-gate add %g2, 1, %g2 1427c478bd9Sstevel@tonic-gate2: 1437c478bd9Sstevel@tonic-gate sub %g2, 1, %g2 ! restore back to orig window 1447c478bd9Sstevel@tonic-gate brnz %g2, 2b 1457c478bd9Sstevel@tonic-gate restore 1467c478bd9Sstevel@tonic-gate3: 1477c478bd9Sstevel@tonic-gate retl 1487c478bd9Sstevel@tonic-gate nop 1497c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_flush_user_windows) 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate#endif /* lint */ 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gateuint32_t 1567c478bd9Sstevel@tonic-gatedtrace_cas32(uint32_t *target, uint32_t cmp, uint32_t new) 1577c478bd9Sstevel@tonic-gate{ 1587c478bd9Sstevel@tonic-gate uint32_t old; 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate if ((old = *target) == cmp) 1617c478bd9Sstevel@tonic-gate *target = new; 1627c478bd9Sstevel@tonic-gate return (old); 1637c478bd9Sstevel@tonic-gate} 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gatevoid * 1667c478bd9Sstevel@tonic-gatedtrace_casptr(void *target, void *cmp, void *new) 1677c478bd9Sstevel@tonic-gate{ 1687c478bd9Sstevel@tonic-gate void *old; 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate if ((old = *(void **)target) == cmp) 1717c478bd9Sstevel@tonic-gate *(void **)target = new; 1727c478bd9Sstevel@tonic-gate return (old); 1737c478bd9Sstevel@tonic-gate} 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate#else /* lint */ 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate ENTRY(dtrace_cas32) 1787c478bd9Sstevel@tonic-gate cas [%o0], %o1, %o2 1797c478bd9Sstevel@tonic-gate retl 1807c478bd9Sstevel@tonic-gate mov %o2, %o0 1817c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_cas32) 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate ENTRY(dtrace_casptr) 1847c478bd9Sstevel@tonic-gate casn [%o0], %o1, %o2 1857c478bd9Sstevel@tonic-gate retl 1867c478bd9Sstevel@tonic-gate mov %o2, %o0 1877c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_casptr) 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate#endif /* lint */ 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate#if defined(lint) 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 1947c478bd9Sstevel@tonic-gateuintptr_t 1957c478bd9Sstevel@tonic-gatedtrace_caller(int aframes) 1967c478bd9Sstevel@tonic-gate{ 1977c478bd9Sstevel@tonic-gate return (0); 1987c478bd9Sstevel@tonic-gate} 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate#else /* lint */ 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate ENTRY(dtrace_caller) 2037c478bd9Sstevel@tonic-gate sethi %hi(nwin_minus_one), %g4 2047c478bd9Sstevel@tonic-gate ld [%g4 + %lo(nwin_minus_one)], %g4 2057c478bd9Sstevel@tonic-gate rdpr %canrestore, %g2 2067c478bd9Sstevel@tonic-gate cmp %g2, %o0 2077c478bd9Sstevel@tonic-gate bl %icc, 1f 2087c478bd9Sstevel@tonic-gate rdpr %cwp, %g1 2097c478bd9Sstevel@tonic-gate sub %g1, %o0, %g3 2107c478bd9Sstevel@tonic-gate brgez,a,pt %g3, 0f 2117c478bd9Sstevel@tonic-gate wrpr %g3, %cwp 2127c478bd9Sstevel@tonic-gate 2137c478bd9Sstevel@tonic-gate ! 2147c478bd9Sstevel@tonic-gate ! CWP minus the number of frames is negative; we must perform the 2157c478bd9Sstevel@tonic-gate ! arithmetic modulo MAXWIN. 2167c478bd9Sstevel@tonic-gate ! 2177c478bd9Sstevel@tonic-gate add %g4, %g3, %g3 2187c478bd9Sstevel@tonic-gate inc %g3 2197c478bd9Sstevel@tonic-gate wrpr %g3, %cwp 2207c478bd9Sstevel@tonic-gate0: 2217c478bd9Sstevel@tonic-gate mov %i7, %g4 2227c478bd9Sstevel@tonic-gate wrpr %g1, %cwp 2237c478bd9Sstevel@tonic-gate retl 2247c478bd9Sstevel@tonic-gate mov %g4, %o0 2257c478bd9Sstevel@tonic-gate1: 2267c478bd9Sstevel@tonic-gate ! 2277c478bd9Sstevel@tonic-gate ! The caller has been flushed to the stack. This is unlikely 2287c478bd9Sstevel@tonic-gate ! (interrupts are disabled in dtrace_probe()), but possible (the 2297c478bd9Sstevel@tonic-gate ! interrupt inducing the spill may have been taken before the 2307c478bd9Sstevel@tonic-gate ! call to dtrace_probe()). 2317c478bd9Sstevel@tonic-gate ! 2327c478bd9Sstevel@tonic-gate retl 2337c478bd9Sstevel@tonic-gate mov -1, %o0 2347c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_caller) 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate#endif 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate#if defined(lint) 2397c478bd9Sstevel@tonic-gate 2407c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 2417c478bd9Sstevel@tonic-gateint 2427c478bd9Sstevel@tonic-gatedtrace_fish(int aframes, int reg, uintptr_t *regval) 2437c478bd9Sstevel@tonic-gate{ 2447c478bd9Sstevel@tonic-gate return (0); 2457c478bd9Sstevel@tonic-gate} 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate#else /* lint */ 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate ENTRY(dtrace_fish) 2507c478bd9Sstevel@tonic-gate 2517c478bd9Sstevel@tonic-gate rd %pc, %g5 2527c478bd9Sstevel@tonic-gate ba 0f 2537c478bd9Sstevel@tonic-gate add %g5, 12, %g5 2547c478bd9Sstevel@tonic-gate mov %l0, %g4 2557c478bd9Sstevel@tonic-gate mov %l1, %g4 2567c478bd9Sstevel@tonic-gate mov %l2, %g4 2577c478bd9Sstevel@tonic-gate mov %l3, %g4 2587c478bd9Sstevel@tonic-gate mov %l4, %g4 2597c478bd9Sstevel@tonic-gate mov %l5, %g4 2607c478bd9Sstevel@tonic-gate mov %l6, %g4 2617c478bd9Sstevel@tonic-gate mov %l7, %g4 2627c478bd9Sstevel@tonic-gate mov %i0, %g4 2637c478bd9Sstevel@tonic-gate mov %i1, %g4 2647c478bd9Sstevel@tonic-gate mov %i2, %g4 2657c478bd9Sstevel@tonic-gate mov %i3, %g4 2667c478bd9Sstevel@tonic-gate mov %i4, %g4 2677c478bd9Sstevel@tonic-gate mov %i5, %g4 2687c478bd9Sstevel@tonic-gate mov %i6, %g4 2697c478bd9Sstevel@tonic-gate mov %i7, %g4 2707c478bd9Sstevel@tonic-gate0: 2717c478bd9Sstevel@tonic-gate sub %o1, 16, %o1 ! Can only retrieve %l's and %i's 2727c478bd9Sstevel@tonic-gate sll %o1, 2, %o1 ! Multiply by instruction size 2737c478bd9Sstevel@tonic-gate add %g5, %o1, %g5 ! %g5 now contains the instr. to pick 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate sethi %hi(nwin_minus_one), %g4 2767c478bd9Sstevel@tonic-gate ld [%g4 + %lo(nwin_minus_one)], %g4 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate ! 2797c478bd9Sstevel@tonic-gate ! First we need to see if the frame that we're fishing in is still 2807c478bd9Sstevel@tonic-gate ! contained in the register windows. 2817c478bd9Sstevel@tonic-gate ! 2827c478bd9Sstevel@tonic-gate rdpr %canrestore, %g2 2837c478bd9Sstevel@tonic-gate cmp %g2, %o0 2847c478bd9Sstevel@tonic-gate bl %icc, 2f 2857c478bd9Sstevel@tonic-gate rdpr %cwp, %g1 2867c478bd9Sstevel@tonic-gate sub %g1, %o0, %g3 2877c478bd9Sstevel@tonic-gate brgez,a,pt %g3, 0f 2887c478bd9Sstevel@tonic-gate wrpr %g3, %cwp 2897c478bd9Sstevel@tonic-gate 2907c478bd9Sstevel@tonic-gate ! 2917c478bd9Sstevel@tonic-gate ! CWP minus the number of frames is negative; we must perform the 2927c478bd9Sstevel@tonic-gate ! arithmetic modulo MAXWIN. 2937c478bd9Sstevel@tonic-gate ! 2947c478bd9Sstevel@tonic-gate add %g4, %g3, %g3 2957c478bd9Sstevel@tonic-gate inc %g3 2967c478bd9Sstevel@tonic-gate wrpr %g3, %cwp 2977c478bd9Sstevel@tonic-gate0: 2987c478bd9Sstevel@tonic-gate jmp %g5 2997c478bd9Sstevel@tonic-gate ba 1f 3007c478bd9Sstevel@tonic-gate1: 3017c478bd9Sstevel@tonic-gate wrpr %g1, %cwp 3027c478bd9Sstevel@tonic-gate stn %g4, [%o2] 3037c478bd9Sstevel@tonic-gate retl 3047c478bd9Sstevel@tonic-gate clr %o0 ! Success; return 0. 3057c478bd9Sstevel@tonic-gate2: 3067c478bd9Sstevel@tonic-gate ! 3077c478bd9Sstevel@tonic-gate ! The frame that we're looking for has been flushed to the stack; the 3087c478bd9Sstevel@tonic-gate ! caller will be forced to 3097c478bd9Sstevel@tonic-gate ! 3107c478bd9Sstevel@tonic-gate retl 3117c478bd9Sstevel@tonic-gate add %g2, 1, %o0 ! Failure; return deepest frame + 1 3127c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_fish) 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate#endif 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gate#if defined(lint) 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 3197c478bd9Sstevel@tonic-gatevoid 320*28406508Ssudheerdtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size, 321*28406508Ssudheer volatile uint16_t *flags) 3227c478bd9Sstevel@tonic-gate{} 3237c478bd9Sstevel@tonic-gate 3247c478bd9Sstevel@tonic-gate#else 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate ENTRY(dtrace_copyin) 3277c478bd9Sstevel@tonic-gate tst %o2 328*28406508Ssudheer bz 2f 3297c478bd9Sstevel@tonic-gate clr %g1 3307c478bd9Sstevel@tonic-gate lduba [%o0 + %g1]ASI_USER, %g2 3317c478bd9Sstevel@tonic-gate0: 332*28406508Ssudheer ! check for an error if the count is 4k-aligned 333*28406508Ssudheer andcc %g1, 0xfff, %g0 334*28406508Ssudheer bnz,pt %icc, 1f 3357c478bd9Sstevel@tonic-gate stub %g2, [%o1 + %g1] 336*28406508Ssudheer lduh [%o3], %g3 337*28406508Ssudheer andcc %g3, CPU_DTRACE_BADADDR, %g0 338*28406508Ssudheer bnz,pn %icc, 2f 339*28406508Ssudheer nop 340*28406508Ssudheer1: 3417c478bd9Sstevel@tonic-gate inc %g1 3427c478bd9Sstevel@tonic-gate cmp %g1, %o2 3437c478bd9Sstevel@tonic-gate bl,a 0b 3447c478bd9Sstevel@tonic-gate lduba [%o0 + %g1]ASI_USER, %g2 345*28406508Ssudheer2: 3467c478bd9Sstevel@tonic-gate retl 3477c478bd9Sstevel@tonic-gate nop 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_copyin) 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate#endif 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate#if defined(lint) 3547c478bd9Sstevel@tonic-gate 3557c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 3567c478bd9Sstevel@tonic-gatevoid 357*28406508Ssudheerdtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size, 358*28406508Ssudheer volatile uint16_t *flags) 3597c478bd9Sstevel@tonic-gate{} 3607c478bd9Sstevel@tonic-gate 3617c478bd9Sstevel@tonic-gate#else 3627c478bd9Sstevel@tonic-gate 3637c478bd9Sstevel@tonic-gate ENTRY(dtrace_copyinstr) 3647c478bd9Sstevel@tonic-gate tst %o2 365*28406508Ssudheer bz 2f 3667c478bd9Sstevel@tonic-gate clr %g1 3677c478bd9Sstevel@tonic-gate lduba [%o0 + %g1]ASI_USER, %g2 3687c478bd9Sstevel@tonic-gate0: 3697c478bd9Sstevel@tonic-gate stub %g2, [%o1 + %g1] ! Store byte 370*28406508Ssudheer 371*28406508Ssudheer ! check for an error if the count is 4k-aligned 372*28406508Ssudheer andcc %g1, 0xfff, %g0 373*28406508Ssudheer bnz,pt %icc, 1f 374*28406508Ssudheer inc %g1 375*28406508Ssudheer lduh [%o3], %g3 376*28406508Ssudheer andcc %g3, CPU_DTRACE_BADADDR, %g0 377*28406508Ssudheer bnz,pn %icc, 2f 378*28406508Ssudheer nop 379*28406508Ssudheer1: 3807c478bd9Sstevel@tonic-gate cmp %g2, 0 ! Was that '\0'? 381*28406508Ssudheer be 2f ! If so, we're done 3827c478bd9Sstevel@tonic-gate cmp %g1, %o2 ! Compare to limit 3837c478bd9Sstevel@tonic-gate bl,a 0b ! If less, take another lap 3847c478bd9Sstevel@tonic-gate lduba [%o0 + %g1]ASI_USER, %g2 ! delay: load user byte 385*28406508Ssudheer2: 3867c478bd9Sstevel@tonic-gate retl 3877c478bd9Sstevel@tonic-gate nop 3887c478bd9Sstevel@tonic-gate 3897c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_copyinstr) 3907c478bd9Sstevel@tonic-gate 3917c478bd9Sstevel@tonic-gate#endif 3927c478bd9Sstevel@tonic-gate 3937c478bd9Sstevel@tonic-gate#if defined(lint) 3947c478bd9Sstevel@tonic-gate 3957c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 3967c478bd9Sstevel@tonic-gatevoid 397*28406508Ssudheerdtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size, 398*28406508Ssudheer volatile uint16_t *flags) 3997c478bd9Sstevel@tonic-gate{} 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gate#else 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate ENTRY(dtrace_copyout) 4047c478bd9Sstevel@tonic-gate tst %o2 405*28406508Ssudheer bz 2f 4067c478bd9Sstevel@tonic-gate clr %g1 4077c478bd9Sstevel@tonic-gate ldub [%o0 + %g1], %g2 4087c478bd9Sstevel@tonic-gate0: 409*28406508Ssudheer ! check for an error if the count is 4k-aligned 410*28406508Ssudheer andcc %g1, 0xfff, %g0 411*28406508Ssudheer bnz,pt %icc, 1f 4127c478bd9Sstevel@tonic-gate stba %g2, [%o1 + %g1]ASI_USER 413*28406508Ssudheer lduh [%o3], %g3 414*28406508Ssudheer andcc %g3, CPU_DTRACE_BADADDR, %g0 415*28406508Ssudheer bnz,pn %icc, 2f 416*28406508Ssudheer nop 417*28406508Ssudheer1: 4187c478bd9Sstevel@tonic-gate inc %g1 4197c478bd9Sstevel@tonic-gate cmp %g1, %o2 4207c478bd9Sstevel@tonic-gate bl,a 0b 4217c478bd9Sstevel@tonic-gate ldub [%o0 + %g1], %g2 422*28406508Ssudheer2: 4237c478bd9Sstevel@tonic-gate retl 4247c478bd9Sstevel@tonic-gate nop 4257c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_copyout) 4267c478bd9Sstevel@tonic-gate 4277c478bd9Sstevel@tonic-gate#endif 4287c478bd9Sstevel@tonic-gate 4297c478bd9Sstevel@tonic-gate#if defined(lint) 4307c478bd9Sstevel@tonic-gate 4317c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 4327c478bd9Sstevel@tonic-gatevoid 433*28406508Ssudheerdtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size, 434*28406508Ssudheer volatile uint16_t *flags) 4357c478bd9Sstevel@tonic-gate{} 4367c478bd9Sstevel@tonic-gate 4377c478bd9Sstevel@tonic-gate#else 4387c478bd9Sstevel@tonic-gate 4397c478bd9Sstevel@tonic-gate ENTRY(dtrace_copyoutstr) 4407c478bd9Sstevel@tonic-gate tst %o2 441*28406508Ssudheer bz 2f 4427c478bd9Sstevel@tonic-gate clr %g1 4437c478bd9Sstevel@tonic-gate ldub [%o0 + %g1], %g2 4447c478bd9Sstevel@tonic-gate0: 4457c478bd9Sstevel@tonic-gate stba %g2, [%o1 + %g1]ASI_USER 446*28406508Ssudheer 447*28406508Ssudheer ! check for an error if the count is 4k-aligned 448*28406508Ssudheer andcc %g1, 0xfff, %g0 449*28406508Ssudheer bnz,pt %icc, 1f 4507c478bd9Sstevel@tonic-gate inc %g1 451*28406508Ssudheer lduh [%o3], %g3 452*28406508Ssudheer andcc %g3, CPU_DTRACE_BADADDR, %g0 453*28406508Ssudheer bnz,pn %icc, 2f 454*28406508Ssudheer nop 455*28406508Ssudheer1: 456*28406508Ssudheer cmp %g2, 0 457*28406508Ssudheer be 2f 4587c478bd9Sstevel@tonic-gate cmp %g1, %o2 4597c478bd9Sstevel@tonic-gate bl,a 0b 4607c478bd9Sstevel@tonic-gate ldub [%o0 + %g1], %g2 461*28406508Ssudheer2: 4627c478bd9Sstevel@tonic-gate retl 4637c478bd9Sstevel@tonic-gate nop 4647c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_copyoutstr) 4657c478bd9Sstevel@tonic-gate 4667c478bd9Sstevel@tonic-gate#endif 4677c478bd9Sstevel@tonic-gate 4687c478bd9Sstevel@tonic-gate#if defined(lint) 4697c478bd9Sstevel@tonic-gate 4707c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 4717c478bd9Sstevel@tonic-gateuintptr_t 4727c478bd9Sstevel@tonic-gatedtrace_fulword(void *addr) 4737c478bd9Sstevel@tonic-gate{ return (0); } 4747c478bd9Sstevel@tonic-gate 4757c478bd9Sstevel@tonic-gate#else 4767c478bd9Sstevel@tonic-gate 4777c478bd9Sstevel@tonic-gate ENTRY(dtrace_fulword) 4787c478bd9Sstevel@tonic-gate clr %o1 4797c478bd9Sstevel@tonic-gate ldna [%o0]ASI_USER, %o1 4807c478bd9Sstevel@tonic-gate retl 4817c478bd9Sstevel@tonic-gate mov %o1, %o0 4827c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_fulword) 4837c478bd9Sstevel@tonic-gate 4847c478bd9Sstevel@tonic-gate#endif 4857c478bd9Sstevel@tonic-gate 4867c478bd9Sstevel@tonic-gate#if defined(lint) 4877c478bd9Sstevel@tonic-gate 4887c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 4897c478bd9Sstevel@tonic-gateuint8_t 4907c478bd9Sstevel@tonic-gatedtrace_fuword8(void *addr) 4917c478bd9Sstevel@tonic-gate{ return (0); } 4927c478bd9Sstevel@tonic-gate 4937c478bd9Sstevel@tonic-gate#else 4947c478bd9Sstevel@tonic-gate 4957c478bd9Sstevel@tonic-gate ENTRY(dtrace_fuword8) 4967c478bd9Sstevel@tonic-gate clr %o1 4977c478bd9Sstevel@tonic-gate lduba [%o0]ASI_USER, %o1 4987c478bd9Sstevel@tonic-gate retl 4997c478bd9Sstevel@tonic-gate mov %o1, %o0 5007c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_fuword8) 5017c478bd9Sstevel@tonic-gate 5027c478bd9Sstevel@tonic-gate#endif 5037c478bd9Sstevel@tonic-gate 5047c478bd9Sstevel@tonic-gate#if defined(lint) 5057c478bd9Sstevel@tonic-gate 5067c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 5077c478bd9Sstevel@tonic-gateuint16_t 5087c478bd9Sstevel@tonic-gatedtrace_fuword16(void *addr) 5097c478bd9Sstevel@tonic-gate{ return (0); } 5107c478bd9Sstevel@tonic-gate 5117c478bd9Sstevel@tonic-gate#else 5127c478bd9Sstevel@tonic-gate 5137c478bd9Sstevel@tonic-gate ENTRY(dtrace_fuword16) 5147c478bd9Sstevel@tonic-gate clr %o1 5157c478bd9Sstevel@tonic-gate lduha [%o0]ASI_USER, %o1 5167c478bd9Sstevel@tonic-gate retl 5177c478bd9Sstevel@tonic-gate mov %o1, %o0 5187c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_fuword16) 5197c478bd9Sstevel@tonic-gate 5207c478bd9Sstevel@tonic-gate#endif 5217c478bd9Sstevel@tonic-gate 5227c478bd9Sstevel@tonic-gate#if defined(lint) 5237c478bd9Sstevel@tonic-gate 5247c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 5257c478bd9Sstevel@tonic-gateuint32_t 5267c478bd9Sstevel@tonic-gatedtrace_fuword32(void *addr) 5277c478bd9Sstevel@tonic-gate{ return (0); } 5287c478bd9Sstevel@tonic-gate 5297c478bd9Sstevel@tonic-gate#else 5307c478bd9Sstevel@tonic-gate 5317c478bd9Sstevel@tonic-gate ENTRY(dtrace_fuword32) 5327c478bd9Sstevel@tonic-gate clr %o1 5337c478bd9Sstevel@tonic-gate lda [%o0]ASI_USER, %o1 5347c478bd9Sstevel@tonic-gate retl 5357c478bd9Sstevel@tonic-gate mov %o1, %o0 5367c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_fuword32) 5377c478bd9Sstevel@tonic-gate 5387c478bd9Sstevel@tonic-gate#endif 5397c478bd9Sstevel@tonic-gate 5407c478bd9Sstevel@tonic-gate#if defined(lint) 5417c478bd9Sstevel@tonic-gate 5427c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 5437c478bd9Sstevel@tonic-gateuint64_t 5447c478bd9Sstevel@tonic-gatedtrace_fuword64(void *addr) 5457c478bd9Sstevel@tonic-gate{ return (0); } 5467c478bd9Sstevel@tonic-gate 5477c478bd9Sstevel@tonic-gate#else 5487c478bd9Sstevel@tonic-gate 5497c478bd9Sstevel@tonic-gate ENTRY(dtrace_fuword64) 5507c478bd9Sstevel@tonic-gate clr %o1 5517c478bd9Sstevel@tonic-gate ldxa [%o0]ASI_USER, %o1 5527c478bd9Sstevel@tonic-gate retl 5537c478bd9Sstevel@tonic-gate mov %o1, %o0 5547c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_fuword64) 5557c478bd9Sstevel@tonic-gate 5567c478bd9Sstevel@tonic-gate#endif 5577c478bd9Sstevel@tonic-gate 5587c478bd9Sstevel@tonic-gate#if defined(lint) 5597c478bd9Sstevel@tonic-gate 5607c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 5617c478bd9Sstevel@tonic-gateint 5627c478bd9Sstevel@tonic-gatedtrace_getupcstack_top(uint64_t *pcstack, int pcstack_limit, uintptr_t *sp) 5637c478bd9Sstevel@tonic-gate{ return (0); } 5647c478bd9Sstevel@tonic-gate 5657c478bd9Sstevel@tonic-gate#else 5667c478bd9Sstevel@tonic-gate 5677c478bd9Sstevel@tonic-gate /* 5687c478bd9Sstevel@tonic-gate * %g1 pcstack 5697c478bd9Sstevel@tonic-gate * %g2 current window 5707c478bd9Sstevel@tonic-gate * %g3 maxwin (nwindows - 1) 5717c478bd9Sstevel@tonic-gate * %g4 saved %cwp (so we can get back to the original window) 5727c478bd9Sstevel@tonic-gate * %g5 iteration count 5737c478bd9Sstevel@tonic-gate * %g6 saved %fp 5747c478bd9Sstevel@tonic-gate * 5757c478bd9Sstevel@tonic-gate * %o0 pcstack / return value (iteration count) 5767c478bd9Sstevel@tonic-gate * %o1 pcstack_limit 5777c478bd9Sstevel@tonic-gate * %o2 last_fp 5787c478bd9Sstevel@tonic-gate */ 5797c478bd9Sstevel@tonic-gate 5807c478bd9Sstevel@tonic-gate ENTRY(dtrace_getupcstack_top) 5817c478bd9Sstevel@tonic-gate mov %o0, %g1 ! we need the pcstack pointer while 5827c478bd9Sstevel@tonic-gate ! we're visiting other windows 5837c478bd9Sstevel@tonic-gate 5847c478bd9Sstevel@tonic-gate rdpr %otherwin, %g5 ! compute the number of iterations 5857c478bd9Sstevel@tonic-gate cmp %g5, %o1 ! (windows to observe) by taking the 5867c478bd9Sstevel@tonic-gate movg %icc, %o1, %g5 ! min of %otherwin and pcstack_limit 5877c478bd9Sstevel@tonic-gate 5887c478bd9Sstevel@tonic-gate brlez,a,pn %g5, 2f ! return 0 if count <= 0 5897c478bd9Sstevel@tonic-gate clr %o0 5907c478bd9Sstevel@tonic-gate 5917c478bd9Sstevel@tonic-gate sethi %hi(nwin_minus_one), %g3 ! hang onto maxwin since we'll need 5927c478bd9Sstevel@tonic-gate ld [%g3 + %lo(nwin_minus_one)], %g3 ! it for our modular arithmetic 5937c478bd9Sstevel@tonic-gate 5947c478bd9Sstevel@tonic-gate rdpr %cwp, %g4 ! remember our window so we can return 5957c478bd9Sstevel@tonic-gate rdpr %canrestore, %g2 ! compute the first non-user window 5960b38a8bdSahl subcc %g4, %g2, %g2 ! current = %cwp - %canrestore 5977c478bd9Sstevel@tonic-gate 5987c478bd9Sstevel@tonic-gate bge,pt %xcc, 1f ! good to go if current is >= 0 5997c478bd9Sstevel@tonic-gate mov %g5, %o0 ! we need to return the count 6007c478bd9Sstevel@tonic-gate 6017c478bd9Sstevel@tonic-gate add %g2, %g3, %g2 ! normalize our current window if it's 6027c478bd9Sstevel@tonic-gate add %g2, 1, %g2 ! less than zero 6037c478bd9Sstevel@tonic-gate 6047c478bd9Sstevel@tonic-gate ! note that while it's tempting, we can't execute restore to decrement 6057c478bd9Sstevel@tonic-gate ! the %cwp by one (mod nwindows) because we're in the user's windows 6067c478bd9Sstevel@tonic-gate1: 6077c478bd9Sstevel@tonic-gate deccc %g2 ! decrement the current window 6087c478bd9Sstevel@tonic-gate movl %xcc, %g3, %g2 ! normalize if it's negative (-1) 6097c478bd9Sstevel@tonic-gate 6107c478bd9Sstevel@tonic-gate wrpr %g2, %cwp ! change windows 6117c478bd9Sstevel@tonic-gate 6127c478bd9Sstevel@tonic-gate stx %i7, [%g1] ! stash the return address in pcstack 6137c478bd9Sstevel@tonic-gate 6147c478bd9Sstevel@tonic-gate deccc %g5 ! decrement the count 6157c478bd9Sstevel@tonic-gate bnz,pt %icc, 1b ! we iterate until the count reaches 0 6167c478bd9Sstevel@tonic-gate add %g1, 8, %g1 ! increment the pcstack pointer 6177c478bd9Sstevel@tonic-gate 6187c478bd9Sstevel@tonic-gate mov %i6, %g6 ! stash the last frame pointer we 6197c478bd9Sstevel@tonic-gate ! encounter so the caller can 6207c478bd9Sstevel@tonic-gate ! continue the stack walk in memory 6217c478bd9Sstevel@tonic-gate 6227c478bd9Sstevel@tonic-gate wrpr %g4, %cwp ! change back to the original window 6237c478bd9Sstevel@tonic-gate 6247c478bd9Sstevel@tonic-gate stn %g6, [%o2] ! return the last frame pointer 6257c478bd9Sstevel@tonic-gate 6267c478bd9Sstevel@tonic-gate2: 6277c478bd9Sstevel@tonic-gate retl 6287c478bd9Sstevel@tonic-gate nop 6297c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_getupcstack_top) 6307c478bd9Sstevel@tonic-gate 6317c478bd9Sstevel@tonic-gate#endif 6327c478bd9Sstevel@tonic-gate 6330b38a8bdSahl#if defined(lint) 6340b38a8bdSahl 6350b38a8bdSahl/*ARGSUSED*/ 6360b38a8bdSahlint 6370b38a8bdSahldtrace_getustackdepth_top(uintptr_t *sp) 6380b38a8bdSahl{ return (0); } 6390b38a8bdSahl 6400b38a8bdSahl#else 6410b38a8bdSahl 6420b38a8bdSahl ENTRY(dtrace_getustackdepth_top) 6430b38a8bdSahl mov %o0, %o2 6440b38a8bdSahl rdpr %otherwin, %o0 6450b38a8bdSahl 6460b38a8bdSahl brlez,a,pn %o0, 2f ! return 0 if there are no user wins 6470b38a8bdSahl clr %o0 6480b38a8bdSahl 6490b38a8bdSahl rdpr %cwp, %g4 ! remember our window so we can return 6500b38a8bdSahl rdpr %canrestore, %g2 ! compute the first user window 6510b38a8bdSahl sub %g4, %g2, %g2 ! current = %cwp - %canrestore - 6520b38a8bdSahl subcc %g2, %o0, %g2 ! %otherwin 6530b38a8bdSahl 6540b38a8bdSahl bge,pt %xcc, 1f ! normalize the window if necessary 6550b38a8bdSahl sethi %hi(nwin_minus_one), %g3 6560b38a8bdSahl ld [%g3 + %lo(nwin_minus_one)], %g3 6570b38a8bdSahl add %g2, %g3, %g2 6580b38a8bdSahl add %g2, 1, %g2 6590b38a8bdSahl 6600b38a8bdSahl1: 6610b38a8bdSahl wrpr %g2, %cwp ! change to the first user window 6620b38a8bdSahl mov %i6, %g6 ! stash the frame pointer 6630b38a8bdSahl wrpr %g4, %cwp ! change back to the original window 6640b38a8bdSahl 6650b38a8bdSahl stn %g6, [%o2] ! return the frame pointer 6660b38a8bdSahl 6670b38a8bdSahl2: 6680b38a8bdSahl retl 6690b38a8bdSahl nop 6700b38a8bdSahl SET_SIZE(dtrace_getustackdepth_top) 6710b38a8bdSahl 6720b38a8bdSahl#endif 6730b38a8bdSahl 6747c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 6757c478bd9Sstevel@tonic-gate 6767c478bd9Sstevel@tonic-gate/* ARGSUSED */ 6777c478bd9Sstevel@tonic-gateulong_t 6787c478bd9Sstevel@tonic-gatedtrace_getreg_win(uint_t reg, uint_t depth) 6797c478bd9Sstevel@tonic-gate{ return (0); } 6807c478bd9Sstevel@tonic-gate 6817c478bd9Sstevel@tonic-gate#else /* lint */ 6827c478bd9Sstevel@tonic-gate 6837c478bd9Sstevel@tonic-gate ENTRY(dtrace_getreg_win) 6847c478bd9Sstevel@tonic-gate sub %o0, 16, %o0 6857c478bd9Sstevel@tonic-gate cmp %o0, 16 ! %o0 must begin in the range [16..32) 6867c478bd9Sstevel@tonic-gate blu,pt %xcc, 1f 6877c478bd9Sstevel@tonic-gate nop 6887c478bd9Sstevel@tonic-gate retl 6897c478bd9Sstevel@tonic-gate clr %o0 6907c478bd9Sstevel@tonic-gate 6917c478bd9Sstevel@tonic-gate1: 6927c478bd9Sstevel@tonic-gate set dtrace_getreg_win_table, %g3 6937c478bd9Sstevel@tonic-gate sll %o0, 2, %o0 6947c478bd9Sstevel@tonic-gate add %g3, %o0, %g3 6957c478bd9Sstevel@tonic-gate 6967c478bd9Sstevel@tonic-gate rdpr %canrestore, %o3 6977c478bd9Sstevel@tonic-gate rdpr %cwp, %g2 6987c478bd9Sstevel@tonic-gate 6997c478bd9Sstevel@tonic-gate ! Set %cwp to be (%cwp - %canrestore - %o1) mod NWINDOWS 7007c478bd9Sstevel@tonic-gate 7017c478bd9Sstevel@tonic-gate sub %g2, %o3, %o2 ! %o2 is %cwp - %canrestore 7027c478bd9Sstevel@tonic-gate subcc %o2, %o1, %o4 7037c478bd9Sstevel@tonic-gate bge,a,pn %xcc, 2f 7047c478bd9Sstevel@tonic-gate wrpr %o4, %cwp 7057c478bd9Sstevel@tonic-gate 7067c478bd9Sstevel@tonic-gate sethi %hi(nwin_minus_one), %o3 7077c478bd9Sstevel@tonic-gate ld [%o3 + %lo(nwin_minus_one)], %o3 7087c478bd9Sstevel@tonic-gate 7097c478bd9Sstevel@tonic-gate add %o2, %o3, %o4 7107c478bd9Sstevel@tonic-gate wrpr %o4, %cwp 7117c478bd9Sstevel@tonic-gate2: 7127c478bd9Sstevel@tonic-gate jmp %g3 7137c478bd9Sstevel@tonic-gate ba 3f 7147c478bd9Sstevel@tonic-gate3: 7157c478bd9Sstevel@tonic-gate wrpr %g2, %cwp 7167c478bd9Sstevel@tonic-gate retl 7177c478bd9Sstevel@tonic-gate mov %g1, %o0 7187c478bd9Sstevel@tonic-gate 7197c478bd9Sstevel@tonic-gatedtrace_getreg_win_table: 7207c478bd9Sstevel@tonic-gate mov %l0, %g1 7217c478bd9Sstevel@tonic-gate mov %l1, %g1 7227c478bd9Sstevel@tonic-gate mov %l2, %g1 7237c478bd9Sstevel@tonic-gate mov %l3, %g1 7247c478bd9Sstevel@tonic-gate mov %l4, %g1 7257c478bd9Sstevel@tonic-gate mov %l5, %g1 7267c478bd9Sstevel@tonic-gate mov %l6, %g1 7277c478bd9Sstevel@tonic-gate mov %l7, %g1 7287c478bd9Sstevel@tonic-gate mov %i0, %g1 7297c478bd9Sstevel@tonic-gate mov %i1, %g1 7307c478bd9Sstevel@tonic-gate mov %i2, %g1 7317c478bd9Sstevel@tonic-gate mov %i3, %g1 7327c478bd9Sstevel@tonic-gate mov %i4, %g1 7337c478bd9Sstevel@tonic-gate mov %i5, %g1 7347c478bd9Sstevel@tonic-gate mov %i6, %g1 7357c478bd9Sstevel@tonic-gate mov %i7, %g1 7367c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_getreg_win) 7377c478bd9Sstevel@tonic-gate 7387c478bd9Sstevel@tonic-gate#endif /* lint */ 7397c478bd9Sstevel@tonic-gate 7407c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 7417c478bd9Sstevel@tonic-gate 7427c478bd9Sstevel@tonic-gate/* ARGSUSED */ 7437c478bd9Sstevel@tonic-gatevoid 7447c478bd9Sstevel@tonic-gatedtrace_putreg_win(uint_t reg, ulong_t value) 7457c478bd9Sstevel@tonic-gate{} 7467c478bd9Sstevel@tonic-gate 7477c478bd9Sstevel@tonic-gate#else /* lint */ 7487c478bd9Sstevel@tonic-gate 7497c478bd9Sstevel@tonic-gate ENTRY(dtrace_putreg_win) 7507c478bd9Sstevel@tonic-gate sub %o0, 16, %o0 7517c478bd9Sstevel@tonic-gate cmp %o0, 16 ! %o0 must be in the range [16..32) 7527c478bd9Sstevel@tonic-gate blu,pt %xcc, 1f 7537c478bd9Sstevel@tonic-gate nop 7547c478bd9Sstevel@tonic-gate retl 7557c478bd9Sstevel@tonic-gate nop 7567c478bd9Sstevel@tonic-gate 7577c478bd9Sstevel@tonic-gate1: 7587c478bd9Sstevel@tonic-gate mov %o1, %g1 ! move the value into a global register 7597c478bd9Sstevel@tonic-gate 7607c478bd9Sstevel@tonic-gate set dtrace_putreg_table, %g3 7617c478bd9Sstevel@tonic-gate sll %o0, 2, %o0 7627c478bd9Sstevel@tonic-gate add %g3, %o0, %g3 7637c478bd9Sstevel@tonic-gate 7647c478bd9Sstevel@tonic-gate rdpr %canrestore, %o3 7657c478bd9Sstevel@tonic-gate rdpr %cwp, %g2 7667c478bd9Sstevel@tonic-gate 7677c478bd9Sstevel@tonic-gate ! Set %cwp to be (%cwp - %canrestore - 1) mod NWINDOWS 7687c478bd9Sstevel@tonic-gate 7697c478bd9Sstevel@tonic-gate sub %g2, %o3, %o2 ! %o2 is %cwp - %canrestore 7707c478bd9Sstevel@tonic-gate subcc %o2, 1, %o4 7717c478bd9Sstevel@tonic-gate bge,a,pn %xcc, 2f 7727c478bd9Sstevel@tonic-gate wrpr %o4, %cwp 7737c478bd9Sstevel@tonic-gate 7747c478bd9Sstevel@tonic-gate sethi %hi(nwin_minus_one), %o3 7757c478bd9Sstevel@tonic-gate ld [%o3 + %lo(nwin_minus_one)], %o3 7767c478bd9Sstevel@tonic-gate add %o2, %o3, %o4 7777c478bd9Sstevel@tonic-gate wrpr %o4, %cwp 7787c478bd9Sstevel@tonic-gate2: 7797c478bd9Sstevel@tonic-gate jmp %g3 7807c478bd9Sstevel@tonic-gate ba 3f 7817c478bd9Sstevel@tonic-gate3: 7827c478bd9Sstevel@tonic-gate wrpr %g2, %cwp 7837c478bd9Sstevel@tonic-gate retl 7847c478bd9Sstevel@tonic-gate nop 7857c478bd9Sstevel@tonic-gate 7867c478bd9Sstevel@tonic-gatedtrace_putreg_table: 7877c478bd9Sstevel@tonic-gate mov %g1, %l0 7887c478bd9Sstevel@tonic-gate mov %g1, %l1 7897c478bd9Sstevel@tonic-gate mov %g1, %l2 7907c478bd9Sstevel@tonic-gate mov %g1, %l3 7917c478bd9Sstevel@tonic-gate mov %g1, %l4 7927c478bd9Sstevel@tonic-gate mov %g1, %l5 7937c478bd9Sstevel@tonic-gate mov %g1, %l6 7947c478bd9Sstevel@tonic-gate mov %g1, %l7 7957c478bd9Sstevel@tonic-gate mov %g1, %i0 7967c478bd9Sstevel@tonic-gate mov %g1, %i1 7977c478bd9Sstevel@tonic-gate mov %g1, %i2 7987c478bd9Sstevel@tonic-gate mov %g1, %i3 7997c478bd9Sstevel@tonic-gate mov %g1, %i4 8007c478bd9Sstevel@tonic-gate mov %g1, %i5 8017c478bd9Sstevel@tonic-gate mov %g1, %i6 8027c478bd9Sstevel@tonic-gate mov %g1, %i7 8037c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_putreg_win) 8047c478bd9Sstevel@tonic-gate 8057c478bd9Sstevel@tonic-gate#endif /* lint */ 8067c478bd9Sstevel@tonic-gate 8077c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint) 8087c478bd9Sstevel@tonic-gate 8097c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 8107c478bd9Sstevel@tonic-gatevoid 8117c478bd9Sstevel@tonic-gatedtrace_probe_error(dtrace_state_t *state, dtrace_epid_t epid, int which, 8127c478bd9Sstevel@tonic-gate int fault, int fltoffs, uintptr_t illval) 8137c478bd9Sstevel@tonic-gate{} 8147c478bd9Sstevel@tonic-gate 8157c478bd9Sstevel@tonic-gate#else /* lint */ 8167c478bd9Sstevel@tonic-gate 8177c478bd9Sstevel@tonic-gate ENTRY(dtrace_probe_error) 8187c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME), %sp 8197c478bd9Sstevel@tonic-gate sethi %hi(dtrace_probeid_error), %l0 8207c478bd9Sstevel@tonic-gate ld [%l0 + %lo(dtrace_probeid_error)], %o0 8217c478bd9Sstevel@tonic-gate mov %i0, %o1 8227c478bd9Sstevel@tonic-gate mov %i1, %o2 8237c478bd9Sstevel@tonic-gate mov %i2, %o3 8247c478bd9Sstevel@tonic-gate mov %i3, %o4 8257c478bd9Sstevel@tonic-gate call dtrace_probe 8267c478bd9Sstevel@tonic-gate mov %i4, %o5 8277c478bd9Sstevel@tonic-gate ret 8287c478bd9Sstevel@tonic-gate restore 8297c478bd9Sstevel@tonic-gate SET_SIZE(dtrace_probe_error) 8307c478bd9Sstevel@tonic-gate 8317c478bd9Sstevel@tonic-gate#endif 832