xref: /freebsd/sys/amd64/include/asmacros.h (revision afe61c15161c324a7af299a9b8457aba5afc92db)
1 #define ALIGN_DATA	.align	2	/* 4 byte alignment, zero filled */
2 #define ALIGN_TEXT	.align	2,0x90	/* 4-byte alignment, nop filled */
3 #define SUPERALIGN_TEXT	.align	4,0x90	/* 16-byte alignment (better for 486), nop filled */
4 
5 #define GEN_ENTRY(name)		ALIGN_TEXT;	.globl name; name:
6 #define NON_GPROF_ENTRY(name)	GEN_ENTRY(_/**/name)
7 
8 /* These three are place holders for future changes to the profiling code */
9 #define MCOUNT_LABEL(name)
10 #define MEXITCOUNT
11 #define FAKE_MCOUNT(caller)
12 
13 #ifdef GPROF
14 /*
15  * ALTENTRY() must be before a corresponding ENTRY() so that it can jump
16  * over the mcounting.
17  */
18 #define ALTENTRY(name)	GEN_ENTRY(_/**/name); MCOUNT; jmp 2f
19 #define ENTRY(name)	GEN_ENTRY(_/**/name); MCOUNT; 2:
20 /*
21  * The call to mcount supports the usual (bad) conventions.  We allocate
22  * some data and pass a pointer to it although the FreeBSD doesn't use
23  * the data.  We set up a frame before calling mcount because that is
24  * the standard convention although it makes work for both mcount and
25  * callers.
26  */
27 #define MCOUNT		.data; ALIGN_DATA; 1:; .long 0; .text; \
28 			pushl %ebp; movl %esp,%ebp; \
29 			movl $1b,%eax; call mcount; popl %ebp
30 #else
31 /*
32  * ALTENTRY() has to align because it is before a corresponding ENTRY().
33  * ENTRY() has to align to because there may be no ALTENTRY() before it.
34  * If there is a previous ALTENTRY() then the alignment code is empty.
35  */
36 #define ALTENTRY(name)	GEN_ENTRY(_/**/name)
37 #define ENTRY(name)	GEN_ENTRY(_/**/name)
38 #define MCOUNT
39 
40 #endif
41 
42 #ifdef DUMMY_NOPS			/* this will break some older machines */
43 #define FASTER_NOP
44 #define NOP
45 #else
46 #define FASTER_NOP	pushl %eax ; inb $0x84,%al ; popl %eax
47 #define NOP		pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
48 #endif
49 
50