summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/asm.h
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-04-23 19:26:04 +0000
committerbde <bde@FreeBSD.org>1997-04-23 19:26:04 +0000
commit2fefab8f6a0b63fb7f226ac725a7a751e74f69f0 (patch)
tree7ca0107bf7c36a8701bf4a5269e177b7b8fff51b /sys/amd64/include/asm.h
parente95e039f7f1a304711b5a9be383f58cb90a84c14 (diff)
downloadFreeBSD-src-2fefab8f6a0b63fb7f226ac725a7a751e74f69f0.zip
FreeBSD-src-2fefab8f6a0b63fb7f226ac725a7a751e74f69f0.tar.gz
Fixed longstanding profiling bug. The frame pointer wasn't set up
for syscalls, so one frame was lost in backtraces from syscalls. This is handled better in the kernel by using a different mcount entry point for profiling before the frame pointer is set up. Expand RCSID(). Use .p2align instead of the ambiguous .align. Added idempotency ifdef. Removed unused macros ALTENTRY(), ALTASENTRY(), ASENTRY(), _MID_ENTRY. Cleaned up formatting. Reviewed by: jdp reviewed an old version Obtained from: parts from NetBSD
Diffstat (limited to 'sys/amd64/include/asm.h')
-rw-r--r--sys/amd64/include/asm.h86
1 files changed, 23 insertions, 63 deletions
diff --git a/sys/amd64/include/asm.h b/sys/amd64/include/asm.h
index 650181d..f102317 100644
--- a/sys/amd64/include/asm.h
+++ b/sys/amd64/include/asm.h
@@ -34,9 +34,12 @@
* SUCH DAMAGE.
*
* from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90
- * $Id: asm.h,v 1.2 1997/03/09 13:57:32 bde Exp $
+ * $Id: asm.h,v 1.3 1997/04/15 14:06:34 bde Exp $
*/
+#ifndef _MACHINE_ASM_H_
+#define _MACHINE_ASM_H_
+
#include <sys/cdefs.h>
#ifdef PIC
@@ -66,66 +69,37 @@
* language name. HIDENAME is given an assembly-language name, and expands
* to a possibly-modified form that will be invisible to C programs.
*/
-#if defined(__ELF__) /* { */
+#ifdef __ELF__
#define CNAME(csym) csym
#define HIDENAME(asmsym) __CONCAT(.,asmsym)
-#else /* } { */
+#else
#define CNAME(csym) __CONCAT(_,csym)
#define HIDENAME(asmsym) asmsym
-#endif /* } */
-
-
-/* XXX should use align 4,0x90 for -m486. */
-#define _START_ENTRY .text; .align 2,0x90;
-#if 0
-/* Data is not used, except perhaps by non-g prof, which we don't support. */
-#define _MID_ENTRY .data; .align 2; 8:; .long 0; \
- .text; lea 8b,%eax;
-#else
-#define _MID_ENTRY
#endif
-#ifdef PROF
-
-#define ALTENTRY(x) _START_ENTRY \
- .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \
- _MID_ENTRY \
- call HIDENAME(mcount); jmp 9f
-
-#define ENTRY(x) _START_ENTRY \
- .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \
- _MID_ENTRY \
- call HIDENAME(mcount); 9:
-
-
-#define ALTASENTRY(x) _START_ENTRY \
- .globl x; .type x,@function; x:; \
- _MID_ENTRY \
- call HIDENAME(mcount); jmp 9f
-
-#define ASENTRY(x) _START_ENTRY \
- .globl x; .type x,@function; x:; \
- _MID_ENTRY \
- call HIDENAME(mcount); 9:
-
-#else /* !PROF */
+/* XXX should use .p2align 4,0x90 for -m486. */
+#define _START_ENTRY .text; .p2align 2,0x90
-#define ENTRY(x) _START_ENTRY .globl CNAME(x); .type CNAME(x),@function; \
- CNAME(x):
-#define ALTENTRY(x) ENTRY(x)
-
-#define ASENTRY(x) _START_ENTRY .globl x; .type x,@function; x:
-#define ALTASENTRY(x) ASENTRY(x)
+#define _ENTRY(x) _START_ENTRY; \
+ .globl CNAME(x); .type CNAME(x),@function; CNAME(x):
+#ifdef PROF
+#define ENTRY(x) _ENTRY(x); \
+ pushl %ebp; movl %esp,%ebp; \
+ call PIC_PLT(HIDENAME(mcount)); \
+ popl %ebp
+#else
+#define ENTRY(x) _ENTRY(x)
#endif
+#define RCSID(x) .text; .asciz x
+
#ifdef _ARCH_INDIRECT
/*
* Generate code to select between the generic functions and _ARCH_INDIRECT
* specific ones.
* XXX nested __CONCATs don't work with non-ANSI cpp's.
*/
-#undef ENTRY
#define ANAME(x) CNAME(__CONCAT(__CONCAT(__,_ARCH_INDIRECT),x))
#define ASELNAME(x) CNAME(__CONCAT(__arch_select_,x))
#define AVECNAME(x) CNAME(__CONCAT(__arch_,x))
@@ -174,31 +148,17 @@
jmpl *%eax
#endif /* PIC */
-#define ARCH_VECTOR(x) .data; .align 2; \
+#define ARCH_VECTOR(x) .data; .p2align 2; \
.globl AVECNAME(x); \
.type AVECNAME(x),@object; \
.size AVECNAME(x),4; \
AVECNAME(x): .long ASELNAME(x)
-#ifdef PROF
-
-#define ALTENTRY(x) ENTRY(x); jmp 9f
-#define ENTRY(x) ARCH_VECTOR(x); ARCH_SELECT(x); ARCH_DISPATCH(x); \
- _START_ENTRY; \
- .globl ANAME(x); .type ANAME(x),@function; ANAME(x):; \
- call HIDENAME(mcount); 9:
-
-#else /* !PROF */
-
-#define ALTENTRY(x) ENTRY(x)
-#define ENTRY(x) ARCH_VECTOR(x); ARCH_SELECT(x); ARCH_DISPATCH(x); \
+#undef _ENTRY
+#define _ENTRY(x) ARCH_VECTOR(x); ARCH_SELECT(x); ARCH_DISPATCH(x); \
_START_ENTRY; \
.globl ANAME(x); .type ANAME(x),@function; ANAME(x):
-#endif /* PROF */
-
#endif /* _ARCH_INDIRECT */
-#ifndef RCSID
-#define RCSID(a)
-#endif
+#endif /* !_MACHINE_ASM_H_ */
OpenPOWER on IntegriCloud