static char *sccsid
= "@(#)tahoe.c 1.1 (Berkeley) %G%";
* a namelist entry to be the child of indirect callf
(unsigned long) 0 , /* the pc entry point */
(unsigned long) 0 , /* entry point aligned to histogram */
(double) 0.0 , /* ticks in this routine */
(double) 0.0 , /* cumulative ticks in children */
(long) 0 , /* how many times called */
(long) 0 , /* how many calls to self */
(double) 1.0 , /* propagation fraction */
(double) 0.0 , /* self propagation time */
(double) 0.0 , /* child propagation time */
(bool) 0 , /* print flag */
(int) 0 , /* index in the graph list */
(int) 0 , /* graph call chain top-sort order */
(int) 0 , /* internal number of cycle on */
(struct nl
*) &indirectchild
, /* pointer to head of cycle */
(struct nl
*) 0 , /* pointer to next member of cycle */
(arctype
*) 0 , /* list of caller arcs */
(arctype
*) 0 /* list of callee arcs */
long usesreg
= ((long)*modep
) & 0xf;
switch ( ((long)*modep
) >> 4 ) {
return ( usesreg
!= 0xe ? autoinc
: immediate
);
return ( usesreg
!= PC
? autoincdef
: absolute
);
return ( usesreg
!= PC
? bytedisp
: byterel
);
return ( usesreg
!= PC
? bytedispdef
: bytereldef
);
return ( usesreg
!= PC
? worddisp
: wordrel
);
return ( usesreg
!= PC
? worddispdef
: wordreldef
);
return ( usesreg
!= PC
? longdisp
: longrel
);
return ( usesreg
!= PC
? longdispdef
: longreldef
);
return "register deferred";
return "autoincrement deferred";
return "byte displacement";
return "byte displacement deferred";
return "byte relative deferred";
return "word displacement";
return "word displacement deferred";
return "word relative deferred";
return "long displacement";
return "long displacement deferred";
return "long relative deferred";
switch ( operandmode( modep
) ) {
return 1+operandlength( modep
+ 1 );
operandenum mode
= operandmode( modep
);
cp
+= 1; /* skip over the mode */
fprintf( stderr
, "[reladdr] not relative address\n" );
return (unsigned long) modep
;
return (unsigned long) ( cp
+ sizeof *cp
+ *cp
);
for (i
= 0; i
< sizeof *sp
; i
++)
value
= (value
<< 8) + (cp
[i
] & 0xff);
return (unsigned long) ( cp
+ sizeof *sp
+ value
);
for (i
= 0; i
< sizeof *lp
; i
++)
value
= (value
<< 8) + (cp
[i
] & 0xff);
return (unsigned long) ( cp
+ sizeof *lp
+ value
);
findcallf( parentp
, p_lowpc
, p_highpc
)
unsigned char *instructp
;
if ( p_lowpc
< s_lowpc
) {
if ( p_highpc
> s_highpc
) {
if ( debug
& CALLDEBUG
) {
printf( "[findcallf] %s: 0x%x to 0x%x\n" ,
parentp
-> name
, p_lowpc
, p_highpc
);
for ( instructp
= textspace
+ p_lowpc
;
instructp
< textspace
+ p_highpc
;
if ( *instructp
== CALLF
) {
* maybe a callf, better check it out.
* skip the count of the number of arguments.
if ( debug
& CALLDEBUG
) {
printf( "[findcallf]\t0x%x:callf" , instructp
- textspace
);
firstmode
= operandmode( instructp
+length
);
length
+= operandlength( instructp
+length
);
mode
= operandmode( instructp
+ length
);
if ( debug
& CALLDEBUG
) {
printf( "\tfirst operand is %s", operandname( firstmode
) );
printf( "\tsecond operand is %s\n" , operandname( mode
) );
* indirect call: call through pointer
* either *d(r) as a parameter or local
* [are there others that we miss?,
* e.g. arrays of pointers to functions???]
addarc( parentp
, &indirectchild
, (long) 0 );
length
+= operandlength( instructp
+ length
);
* regular pc relative addressing
* check that this is the address of
destpc
= reladdr( instructp
+length
)
- (unsigned long) textspace
;
if ( destpc
>= s_lowpc
&& destpc
<= s_highpc
) {
childp
= nllookup( destpc
);
if ( debug
& CALLDEBUG
) {
printf( "[findcallf]\tdestpc 0x%x" , destpc
);
printf( " childp->name %s" , childp
-> name
);
printf( " childp->value 0x%x\n" ,
if ( childp
-> value
== destpc
) {
addarc( parentp
, childp
, (long) 0 );
length
+= operandlength( instructp
+ length
);
* it looked like a callf,
* but it wasn't to anywhere.
* something funny going on.
if ( debug
& CALLDEBUG
) {
printf( "[findcallf]\tbut it's a botch\n" );