192e807e6Sahl# 292e807e6Sahl# CDDL HEADER START 392e807e6Sahl# 492e807e6Sahl# The contents of this file are subject to the terms of the 592e807e6Sahl# Common Development and Distribution License (the "License"). 692e807e6Sahl# You may not use this file except in compliance with the License. 792e807e6Sahl# 892e807e6Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 992e807e6Sahl# or http://www.opensolaris.org/os/licensing. 1092e807e6Sahl# See the License for the specific language governing permissions 1192e807e6Sahl# and limitations under the License. 1292e807e6Sahl# 1392e807e6Sahl# When distributing Covered Code, include this CDDL HEADER in each 1492e807e6Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1592e807e6Sahl# If applicable, add the following below this CDDL HEADER, with the 1692e807e6Sahl# fields enclosed by brackets "[]" replaced with your own identifying 1792e807e6Sahl# information: Portions Copyright [yyyy] [name of copyright owner] 1892e807e6Sahl# 1992e807e6Sahl# CDDL HEADER END 2092e807e6Sahl# 2192e807e6Sahl 2292e807e6Sahl# 2392e807e6Sahl# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 2492e807e6Sahl# Use is subject to license terms. 2592e807e6Sahl# 2692e807e6Sahl 2792e807e6Sahl# 2892e807e6Sahl# ASSERTION: Make sure USDT probes work as tail-calls on SPARC. 2992e807e6Sahl# 3092e807e6Sahl 3192e807e6Sahlif [ $# != 1 ]; then 3292e807e6Sahl echo expected one argument: '<'dtrace-path'>' 3392e807e6Sahl exit 2 3492e807e6Sahlfi 3592e807e6Sahl 3692e807e6Sahldtrace=$1 3792e807e6SahlDIR=/var/tmp/dtest.$$ 3892e807e6Sahl 3992e807e6Sahlmkdir $DIR 4092e807e6Sahlcd $DIR 4192e807e6Sahl 4292e807e6Sahlcat > test.s <<EOF 4392e807e6Sahl#include <sys/asm_linkage.h> 4492e807e6Sahl 4592e807e6Sahl DGDEF(__fsr_init_value) 4692e807e6Sahl .word 0 4792e807e6Sahl 4892e807e6Sahl ENTRY(test) 4992e807e6Sahl save %sp, -SA(MINFRAME + 4), %sp 5092e807e6Sahl mov 9, %i0 5192e807e6Sahl mov 19, %i1 5292e807e6Sahl mov 2006, %i2 5392e807e6Sahl call __dtrace_test___fire 5492e807e6Sahl restore 5592e807e6Sahl SET_SIZE(test) 5692e807e6Sahl 5792e807e6Sahl ENTRY(main) 5892e807e6Sahl save %sp, -SA(MINFRAME + 4), %sp 5992e807e6Sahl 6092e807e6Sahl1: 6192e807e6Sahl call test 6292e807e6Sahl nop 6392e807e6Sahl 6492e807e6Sahl ba 1b 6592e807e6Sahl nop 6692e807e6Sahl 6792e807e6Sahl ret 6892e807e6Sahl restore %g0, %g0, %o0 6992e807e6Sahl SET_SIZE(main) 7092e807e6SahlEOF 7192e807e6Sahl 7292e807e6Sahlcat > prov.d <<EOF 7392e807e6Sahlprovider test { 7492e807e6Sahl probe fire(int, int, int); 7592e807e6Sahl}; 7692e807e6SahlEOF 7792e807e6Sahl 7892e807e6Sahl/usr/ccs/bin/as -xregsym=no -P -D_ASM -o test.o test.s 7992e807e6Sahlif [ $? -ne 0 ]; then 8092e807e6Sahl print -u2 "failed to compile test.s" 8192e807e6Sahl exit 1 8292e807e6Sahlfi 8392e807e6Sahl 8492e807e6Sahl$dtrace -G -32 -s prov.d test.o 8592e807e6Sahlif [ $? -ne 0 ]; then 8692e807e6Sahl print -u2 "failed to create DOF" 8792e807e6Sahl exit 1 8892e807e6Sahlfi 8992e807e6Sahl 90*a386cc11SRobert Mustacchigcc -m32 -o test test.o prov.o 9192e807e6Sahlif [ $? -ne 0 ]; then 9292e807e6Sahl print -u2 "failed to link final executable" 9392e807e6Sahl exit 1 9492e807e6Sahlfi 9592e807e6Sahl 9692e807e6Sahl$dtrace -c ./test -s /dev/stdin <<EOF 9792e807e6Sahltest\$target:::fire 9892e807e6Sahl/arg0 == 9 && arg1 == 19 && arg2 == 2006/ 9992e807e6Sahl{ 10092e807e6Sahl printf("%d/%d/%d", arg0, arg1, arg2); 10192e807e6Sahl exit(0); 10292e807e6Sahl} 10392e807e6Sahl 10492e807e6Sahltest\$target:::fire 10592e807e6Sahl{ 10692e807e6Sahl printf("%d/%d/%d", arg0, arg1, arg2); 10792e807e6Sahl exit(1); 10892e807e6Sahl} 10992e807e6Sahl 11092e807e6SahlBEGIN 11192e807e6Sahl{ 11292e807e6Sahl /* 11392e807e6Sahl * Let's just do this for 5 seconds. 11492e807e6Sahl */ 11592e807e6Sahl timeout = timestamp + 5000000000; 11692e807e6Sahl} 11792e807e6Sahl 11892e807e6Sahlprofile:::tick-4 11992e807e6Sahl/timestamp > timeout/ 12092e807e6Sahl{ 12192e807e6Sahl trace("test timed out"); 12292e807e6Sahl exit(1); 12392e807e6Sahl} 12492e807e6SahlEOF 12592e807e6Sahl 12692e807e6Sahlstatus=$? 12792e807e6Sahl 12892e807e6Sahlcd / 12992e807e6Sahl/usr/bin/rm -rf $DIR 13092e807e6Sahl 13192e807e6Sahlexit $status 132