summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2008-10-13 12:45:18 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2008-10-13 12:45:18 +0000
commit0b67cc80ccea1d370f023766b88f6e8cc9ae468e (patch)
treedf402dac07468310d4ea60a246a580480bdbb2c3
parentc4d6075d308deac07a78143eb9d9269ce3dadae4 (diff)
Notes
-rw-r--r--sys/i386/include/profile.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/i386/include/profile.h b/sys/i386/include/profile.h
index fe036d8a0751..fb3320b6465d 100644
--- a/sys/i386/include/profile.h
+++ b/sys/i386/include/profile.h
@@ -115,7 +115,15 @@ void user(void);
void \
mcount() \
{ \
- uintfptr_t selfpc, frompc; \
+ uintfptr_t selfpc, frompc, ecx; \
+ /* \
+ * In gcc 4.2, ecx might be used in the caller as the arg \
+ * pointer if the stack realignment option is set (-mstackrealign) \
+ * or if the caller has the force_align_arg_pointer attribute \
+ * (stack realignment is ALWAYS on for main). Preserve ecx \
+ * here. \
+ */ \
+ __asm("" : "=c" (ecx)); \
/* \
* Find the return address for mcount, \
* and the return address for mcount's caller. \
@@ -132,6 +140,7 @@ mcount() \
__asm("movl (%%ebp),%0" : "=r" (frompc)); \
frompc = ((uintfptr_t *)frompc)[1]; \
_mcount(frompc, selfpc); \
+ __asm("" : : "c" (ecx)); \
}
#else /* !__GNUCLIKE_ASM */
#define MCOUNT