aboutsummaryrefslogtreecommitdiffstats
path: root/sys/i386/include/asmacros.h
blob: f0f2c014178c7b2bac03c8d2781b63e784548ffb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#define ALIGN_DATA	.align	2	/* 4 byte alignment, zero filled */
#define ALIGN_TEXT	.align	2,0x90	/* 4-byte alignment, nop filled */
#define SUPERALIGN_TEXT	.align	4,0x90	/* 16-byte alignment (better for 486), nop filled */

#define GEN_ENTRY(name)		ALIGN_TEXT;	.globl name; name:
#define NON_GPROF_ENTRY(name)	GEN_ENTRY(_/**/name)

#ifdef GPROF
/*
 * ALTENTRY() must be before a corresponding ENTRY() so that it can jump
 * over the mcounting.
 */
#define ALTENTRY(name)	GEN_ENTRY(_/**/name); MCOUNT; jmp 2f
#define ENTRY(name)	GEN_ENTRY(_/**/name); MCOUNT; 2:
/*
 * The call to mcount supports the usual (bad) conventions.  We allocate
 * some data and pass a pointer to it although the FreeBSD doesn't use
 * the data.  We set up a frame before calling mcount because that is
 * the standard convention although it makes work for both mcount and
 * callers.
 */
#define MCOUNT		.data; ALIGN_DATA; 1:; .long 0; .text; \
			pushl %ebp; movl %esp,%ebp; \
			movl $1b,%eax; call mcount; popl %ebp
#else
/*
 * ALTENTRY() has to align because it is before a corresponding ENTRY().
 * ENTRY() has to align to because there may be no ALTENTRY() before it.
 * If there is a previous ALTENTRY() then the alignment code is empty.
 */
#define ALTENTRY(name)	GEN_ENTRY(_/**/name)
#define ENTRY(name)	GEN_ENTRY(_/**/name)

#endif

#ifdef DUMMY_NOPS			/* this will break some older machines */
#define FASTER_NOP
#define NOP
#else
#define FASTER_NOP	pushl %eax ; inb $0x84,%al ; popl %eax
#define NOP		pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
#endif