diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 2004-08-27 19:42:35 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2004-08-27 19:42:35 +0000 |
commit | 0f2fe153bcaf941f47617e159a24f2341b7fa1e8 (patch) | |
tree | b2e0d69a2a9be2870443aacf8a3cee8a31cfc5d2 /sys/ia64 | |
parent | 401528f8f84c514f1abf64f4f5334a77186ddeab (diff) | |
download | src-0f2fe153bcaf941f47617e159a24f2341b7fa1e8.tar.gz src-0f2fe153bcaf941f47617e159a24f2341b7fa1e8.zip |
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
Notes
Notes:
svn path=/head/; revision=134398
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/include/profile.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/ia64/include/profile.h b/sys/ia64/include/profile.h index 9c15d002dfb8..91b14e2408d7 100644 --- a/sys/ia64/include/profile.h +++ b/sys/ia64/include/profile.h @@ -26,6 +26,9 @@ * $FreeBSD$ */ +#ifndef _MACHINE_PROFILE_H_ +#define _MACHINE_PROFILE_H_ + #define _MCOUNT_DECL void __mcount #define MCOUNT @@ -41,6 +44,16 @@ typedef unsigned long fptrdiff_t; #define MCOUNT_EXIT(s) intr_restore(s) #define MCOUNT_DECL(s) register_t s; +void bintr(void); +void btrap(void); +void eintr(void); +void user(void); + +#define MCOUNT_FROMPC_USER(pc) \ + ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? ~0UL : pc) + +#define MCOUNT_FROMPC_INTR(pc) (~0UL) + _MCOUNT_DECL(uintfptr_t, uintfptr_t); #else /* !_KERNEL */ @@ -48,3 +61,5 @@ _MCOUNT_DECL(uintfptr_t, uintfptr_t); typedef unsigned long uintfptr_t; #endif + +#endif /* _MACHINE_PROFILE_H_ */ |