* m10300-opc.c (asr, lsr, asl): Fix am33 single bit shift opcode.
[deliverable/binutils-gdb.git] / gprof / sparc.c
CommitLineData
2aed990c 1/*
3d6c6501
SEF
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that: (1) source distributions retain this entire copyright
7 * notice and comment, and (2) distributions including binaries display
8 * the following acknowledgement: ``This product includes software
9 * developed by the University of California, Berkeley and its contributors''
10 * in the documentation or other materials provided with the distribution
11 * and in all advertising materials mentioning features or use of this
12 * software. Neither the name of the University nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 */
5489fcc3
KR
19#include "gprof.h"
20#include "cg_arcs.h"
43870aec 21#include "corefile.h"
5489fcc3
KR
22#include "hist.h"
23#include "symtab.h"
3d6c6501 24
c3de2a19
ILT
25 /*
26 * opcode of the `callf' instruction
27 */
28#define CALL (0xc0000000)
3d6c6501 29
5489fcc3 30void
c3de2a19 31sparc_find_call (parent, p_lowpc, p_highpc)
5489fcc3
KR
32 Sym *parent;
33 bfd_vma p_lowpc;
34 bfd_vma p_highpc;
3d6c6501 35{
12516a37
KR
36 bfd_vma dest_pc, delta;
37 unsigned int *instr;
38 Sym *child;
39
40 delta = (bfd_vma) core_text_space - core_text_sect->vma;
41
42 if (core_text_space == 0)
43 {
44 return;
03c35bcb 45 }
12516a37
KR
46 if (p_lowpc < s_lowpc)
47 {
48 p_lowpc = s_lowpc;
03c35bcb 49 }
12516a37
KR
50 if (p_highpc > s_highpc)
51 {
52 p_highpc = s_highpc;
03c35bcb 53 }
12516a37 54 DBG (CALLDEBUG, printf ("[find_call] %s: 0x%lx to 0x%lx\n",
5489fcc3 55 parent->name, p_lowpc, p_highpc));
1259da3e 56 for (instr = (unsigned int *) (((p_lowpc + delta) + 3) &~ 3);
12516a37
KR
57 instr < (unsigned int *) (p_highpc + delta);
58 ++instr)
5489fcc3 59 {
12516a37
KR
60 if ((*instr & CALL))
61 {
62 DBG (CALLDEBUG,
63 printf ("[find_call] 0x%lx: callf", (bfd_vma) instr - delta));
64 /*
65 * Regular pc relative addressing check that this is the
66 * address of a function.
67 */
68 dest_pc = ((bfd_vma) (instr + (*instr & ~CALL))) - delta;
69 if (dest_pc >= s_lowpc && dest_pc <= s_highpc)
70 {
71 child = sym_lookup (&symtab, dest_pc);
72 DBG (CALLDEBUG,
73 printf ("\tdest_pc=0x%lx, (name=%s, addr=0x%lx)\n",
5489fcc3 74 dest_pc, child->name, child->addr));
12516a37
KR
75 if (child->addr == dest_pc)
76 {
77 /* a hit: */
8c73afb3 78 arc_add (parent, child, (unsigned long) 0);
12516a37 79 continue;
03c35bcb
KR
80 }
81 }
12516a37
KR
82 /*
83 * Something funny going on.
84 */
85 DBG (CALLDEBUG, printf ("\tbut it's a botch\n"));
03c35bcb
KR
86 }
87 }
88}
This page took 0.22964 seconds and 4 git commands to generate.