2 * Copyright (c) 1990 The Regents of the University of California.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 #include "pcc_prefix.s"
21 #define BANNER(str) BLANK .VERSION str
22 #define ENTRY(Name) BLANK M_ENTRY (Name,PROF_/**/Name)
23 #define ENTRYC(Name) BLANK M_ENTRYC(Name,PROF_/**/Name)
24 #define EXIT(Name) BLANK M_EXIT (Name,PROF_/**/Name)
25 #define EXITC(Name) BLANK M_EXITC (Name,PROF_/**/Name)
28 #define TEXT_SEGMENT \
34 #define DATA_SEGMENT \
41 #define TEXT_SEGMENT .text
42 #define RO_SEGMENT .rodata
43 #define DATA_SEGMENT .data
44 #define BSS_SEGMENT .bss
53 ; All four argument registers are saved into caller save registers
54 ; and restored after the call to _mcount
. This is possible because
55 ; the mcount routine does
not modify them
, so we can
. Mcount takes
56 ; 3 arguments
; the first argument is the incoming
'rp', the second
57 ; is the starting address of the profiled routine
, and the third is
58 ; the address of the PROF
label (which is where mcount stores the
61 #define M_ENTRY(name,prof) \
65 .CALLINFO CALLER,SAVE_RP !\
75 ldo R%name(r1),arg1 !\
76 addil L%prof-$global$,dp !\
78 ldo R%prof-$global$(r1),arg2 !\
87 #define M_ENTRYC(name,prof) \
91 .CALLINFO CALLER,SAVE_RP !\
101 ldo R%name(r1),arg1 !\
102 addil L%prof-$global$,dp !\
104 ldo R%prof-$global$(r1),arg2 !\
112 ; The HPUX profiler uses a word
for each entrypoint to store the profiling
113 ; information
. The setup code passes the address to the _mcount routine
.
114 ; The EXIT macro defines a
label (PROF_foo
), and a word of storage
.
116 #define M_EXIT(name,prof) \
120 .EXPORT name,ENTRY !\
124 .IMPORT $global$,DATA !\
127 #define M_EXITC(name,prof) \
132 .EXPORT name,ENTRY !\
136 .IMPORT $global$,DATA !\
139 #else /* NOT profiling */
141 #define M_ENTRY(name,prof) \
148 #define M_ENTRYC(name,prof) \
152 .CALLINFO CALLER,SAVE_RP !\
157 #define M_EXIT(name,prof) \
163 #define M_EXITC(name,prof) \
171 #define ENTRY(Name) BLANK M_ENTRY (Name,PROF_/**/Name)
172 #define ENTRYC(Name) BLANK M_ENTRYC(Name,PROF_/**/Name)
173 #define EXIT(Name) BLANK M_EXIT (Name,PROF_/**/Name)
174 #define EXITC(Name) BLANK M_EXITC (Name,PROF_/**/Name)