summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-08-27 19:42:35 +0000
committermarcel <marcel@FreeBSD.org>2004-08-27 19:42:35 +0000
commit01fd13440d6b5d1349e7ce6b74fe9fcf29d1ff58 (patch)
treeb2e0d69a2a9be2870443aacf8a3cee8a31cfc5d2 /sys/powerpc
parent9b969b5afb1e6125fee738dea17fef52f88a0c7b (diff)
downloadFreeBSD-src-01fd13440d6b5d1349e7ce6b74fe9fcf29d1ff58.zip
FreeBSD-src-01fd13440d6b5d1349e7ce6b74fe9fcf29d1ff58.tar.gz
Move the kernel-specific logic to adjust frompc from MI to MD. For
these two reasons: 1. On ia64 a function pointer does not hold the address of the first instruction of a functions implementation. It holds the address of a function descriptor. Hence the user(), btrap(), eintr() and bintr() prototypes are wrong for getting the actual code address. 2. The logic forces interrupt, trap and exception entry points to be layed-out contiguously. This can not be achieved on ia64 and is generally just bad programming. The MCOUNT_FROMPC_USER macro is used to set the frompc argument to some kernel address which represents any frompc that falls outside the kernel text range. The macro can expand to ~0U to bail out in that case. The MCOUNT_FROMPC_INTR macro is used to set the frompc argument to some kernel address to represent a call to a trap or interrupt handler. This to avoid that the trap or interrupt handler appear to be called from everywhere in the call graph. The macro can expand to ~0U to prevent adjusting frompc. Note that the argument is selfpc, not frompc. This commit defines the macros on all architectures equivalently to the original code in sys/libkern/mcount.c. People can take it from here... Compile-tested on: alpha, amd64, i386, ia64 and sparc64 Boot-tested on: i386
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/include/profile.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/powerpc/include/profile.h b/sys/powerpc/include/profile.h
index 6960fb1..f7ee088 100644
--- a/sys/powerpc/include/profile.h
+++ b/sys/powerpc/include/profile.h
@@ -49,6 +49,20 @@ _mcount() \
#define MCOUNT_ENTER(s)
#define MCOUNT_EXIT(s)
#define MCOUNT_DECL(s)
+
+void bintr(void);
+void btrap(void);
+void eintr(void);
+void user(void);
+
+#define MCOUNT_FROMPC_USER(pc) \
+ ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc)
+
+#define MCOUNT_FROMPC_INTR(pc) \
+ ((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \
+ ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \
+ (uintfptr_t)btrap) : ~0U)
+
#endif
#endif /* !_MACHINE_PROFILE_H_ */
OpenPOWER on IntegriCloud