Deleted Added
full compact
profile.h (169768) profile.h (236992)
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)profile.h 8.1 (Berkeley) 6/11/93
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)profile.h 8.1 (Berkeley) 6/11/93
34 * $FreeBSD: head/sys/arm/include/profile.h 169768 2007-05-19 16:20:37Z cognet $
34 * $FreeBSD: head/sys/arm/include/profile.h 236992 2012-06-13 05:02:51Z imp $
35 */
36
37#ifndef _MACHINE_PROFILE_H_
38#define _MACHINE_PROFILE_H_
39
40/*
35 */
36
37#ifndef _MACHINE_PROFILE_H_
38#define _MACHINE_PROFILE_H_
39
40/*
41 * Config generates something to tell the compiler to align functions on 32
41 * Config generates something to tell the compiler to align functions on 32
42 * byte boundaries. A strict alignment is good for keeping the tables small.
43 */
44#define FUNCTION_ALIGNMENT 16
45
46
47#define _MCOUNT_DECL void mcount
48
49typedef u_long fptrdiff_t;
50
51/*
52 * Cannot implement mcount in C as GCC will trash the ip register when it
53 * pushes a trapframe. Pity we cannot insert assembly before the function
54 * prologue.
55 */
56
57#ifndef PLTSYM
58#define PLTSYM
59#endif
60
61#define MCOUNT \
62 __asm__(".text"); \
63 __asm__(".align 0"); \
64 __asm__(".type __mcount ,%function"); \
65 __asm__(".global __mcount"); \
66 __asm__("__mcount:"); \
67 /* \
68 * Preserve registers that are trashed during mcount \
69 */ \
70 __asm__("stmfd sp!, {r0-r3, ip, lr}"); \
71 /* \
72 * find the return address for mcount, \
73 * and the return address for mcount's caller. \
74 * \
75 * frompcindex = pc pushed by call into self. \
76 */ \
77 __asm__("mov r0, ip"); \
78 /* \
79 * selfpc = pc pushed by mcount call \
80 */ \
81 __asm__("mov r1, lr"); \
82 /* \
83 * Call the real mcount code \
84 */ \
85 __asm__("bl mcount"); \
86 /* \
87 * Restore registers that were trashed during mcount \
88 */ \
89 __asm__("ldmfd sp!, {r0-r3, lr, pc}");
90void bintr(void);
91void btrap(void);
92void eintr(void);
93void user(void);
94
95#define MCOUNT_FROMPC_USER(pc) \
96 ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc)
97
98#define MCOUNT_FROMPC_INTR(pc) \
99 ((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \
100 ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \
101 (uintfptr_t)btrap) : ~0U)
102
103
104#ifdef _KERNEL
105
106#define MCOUNT_DECL(s) register_t s;
107
108#include <machine/asm.h>
109#include <machine/cpufunc.h>
110/*
111 * splhigh() and splx() are heavyweight, and call mcount(). Therefore
112 * we disabled interrupts (IRQ, but not FIQ) directly on the CPU.
113 *
114 * We're lucky that the CPSR and 's' both happen to be 'int's.
115 */
116#define MCOUNT_ENTER(s) {s = intr_disable(); } /* kill IRQ */
117#define MCOUNT_EXIT(s) {intr_restore(s); } /* restore old value */
118
119void mcount(uintfptr_t frompc, uintfptr_t selfpc);
120
121#else
122typedef u_int uintfptr_t;
123#endif /* _KERNEL */
124
125#endif /* !_MACHINE_PROFILE_H_ */
42 * byte boundaries. A strict alignment is good for keeping the tables small.
43 */
44#define FUNCTION_ALIGNMENT 16
45
46
47#define _MCOUNT_DECL void mcount
48
49typedef u_long fptrdiff_t;
50
51/*
52 * Cannot implement mcount in C as GCC will trash the ip register when it
53 * pushes a trapframe. Pity we cannot insert assembly before the function
54 * prologue.
55 */
56
57#ifndef PLTSYM
58#define PLTSYM
59#endif
60
61#define MCOUNT \
62 __asm__(".text"); \
63 __asm__(".align 0"); \
64 __asm__(".type __mcount ,%function"); \
65 __asm__(".global __mcount"); \
66 __asm__("__mcount:"); \
67 /* \
68 * Preserve registers that are trashed during mcount \
69 */ \
70 __asm__("stmfd sp!, {r0-r3, ip, lr}"); \
71 /* \
72 * find the return address for mcount, \
73 * and the return address for mcount's caller. \
74 * \
75 * frompcindex = pc pushed by call into self. \
76 */ \
77 __asm__("mov r0, ip"); \
78 /* \
79 * selfpc = pc pushed by mcount call \
80 */ \
81 __asm__("mov r1, lr"); \
82 /* \
83 * Call the real mcount code \
84 */ \
85 __asm__("bl mcount"); \
86 /* \
87 * Restore registers that were trashed during mcount \
88 */ \
89 __asm__("ldmfd sp!, {r0-r3, lr, pc}");
90void bintr(void);
91void btrap(void);
92void eintr(void);
93void user(void);
94
95#define MCOUNT_FROMPC_USER(pc) \
96 ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc)
97
98#define MCOUNT_FROMPC_INTR(pc) \
99 ((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \
100 ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \
101 (uintfptr_t)btrap) : ~0U)
102
103
104#ifdef _KERNEL
105
106#define MCOUNT_DECL(s) register_t s;
107
108#include <machine/asm.h>
109#include <machine/cpufunc.h>
110/*
111 * splhigh() and splx() are heavyweight, and call mcount(). Therefore
112 * we disabled interrupts (IRQ, but not FIQ) directly on the CPU.
113 *
114 * We're lucky that the CPSR and 's' both happen to be 'int's.
115 */
116#define MCOUNT_ENTER(s) {s = intr_disable(); } /* kill IRQ */
117#define MCOUNT_EXIT(s) {intr_restore(s); } /* restore old value */
118
119void mcount(uintfptr_t frompc, uintfptr_t selfpc);
120
121#else
122typedef u_int uintfptr_t;
123#endif /* _KERNEL */
124
125#endif /* !_MACHINE_PROFILE_H_ */