diff --git a/sys/amd64/include/asm.h b/sys/amd64/include/asm.h index 650181d58756..f1023173b3d4 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 #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_ */ diff --git a/sys/i386/include/asm.h b/sys/i386/include/asm.h index 650181d58756..f1023173b3d4 100644 --- a/sys/i386/include/asm.h +++ b/sys/i386/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 #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_ */