/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <libgen.h>
#include <dt_impl.h>
#include <dt_pid.h>
#define A(x) (((x) >> 29) & 0x01)
#define OP_BRANCH 0
/*ARGSUSED*/
int
{
dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
}
return (1);
}
int
{
int i;
int srdepth = 0;
dt_dprintf("mr sparkle: malloc() failed\n");
return (DT_PROC_ERR);
}
dt_dprintf("mr sparkle: Pread() failed\n");
return (DT_PROC_ERR);
}
/*
* Leave a dummy instruction in the last slot to simplify edge
* conditions.
*/
ftp->ftps_noffs = 0;
/*
* If we encounter an existing tracepoint, query the
* kernel to find out the instruction that was
* replaced at this spot.
*/
while (text[i] == FASTTRAP_INSTR) {
&instr) != 0) {
dt_dprintf("mr sparkle: "
"Pread() failed\n");
return (DT_PROC_ERR);
}
continue;
}
dt_dprintf("mr sparkle: getinstr query "
return (DT_PROC_ERR);
}
break;
}
/* save */
srdepth++;
continue;
}
/* restore */
srdepth--;
continue;
}
if (srdepth > 0) {
/* ret */
if (text[i] == 0x81c7e008)
goto is_ret;
/* return */
if (text[i] == 0x81cfe008)
goto is_ret;
/* call or jmpl w/ restore in the slot */
goto is_ret;
/* call to one of the stret routines */
goto is_ret;
}
} else {
/* external call */
dst += i * 4;
goto is_ret;
}
/* jmpl into %g0 -- this includes the retl pseudo op */
goto is_ret;
/* external branch -- possible return site */
int baa;
case OP2_BPcc:
dst <<= 13;
dst >>= 11;
break;
case OP2_Bicc:
dst <<= 10;
dst >>= 8;
break;
case OP2_BPr:
((text[i]) & 0x3fff);
dst <<= 16;
dst >>= 14;
baa = 0;
break;
case OP2_FBPfcc:
dst <<= 13;
dst >>= 11;
break;
case OP2_FBfcc:
dst <<= 10;
dst >>= 8;
break;
default:
continue;
}
dst += i * 4;
/*
* Interpret branches outside of the function's
* bounds as potential return sites. If the
* branch is a ba,a don't skip the instruction
* in the delay slot.
*/
if (baa)
goto is_ret_baa;
else
goto is_ret;
}
}
}
continue;
i++;
}
if (ftp->ftps_noffs > 0) {
dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
}
}
return (ftp->ftps_noffs);
}
/*ARGSUSED*/
int
{
if (off & 0x3)
return (DT_PROC_ALIGN);
dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
}
return (1);
}
/*ARGSUSED*/
int
{
ulong_t i;
ftp->ftps_noffs = 0;
/*
* If we're matching against everything, just iterate through each
* instruction in the function, otherwise look for matching offset
* names by constructing the string and comparing it against the
* pattern.
*/
}
} else {
}
}
dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
}
return (ftp->ftps_noffs);
}