mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-07 13:14:51 +00:00
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
This commit is contained in:
parent
1c735bb4a5
commit
a862685541
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25111
@ -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
|
||||
|
||||
/* 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):
|
||||
|
||||
#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 */
|
||||
|
||||
#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) _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_ */
|
||||
|
@ -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
|
||||
|
||||
/* 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):
|
||||
|
||||
#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 */
|
||||
|
||||
#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) _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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user