diff options
| author | David Greenman <dg@FreeBSD.org> | 1993-11-13 02:25:21 +0000 |
|---|---|---|
| committer | David Greenman <dg@FreeBSD.org> | 1993-11-13 02:25:21 +0000 |
| commit | 0967373e1c0b42e519f4debc37b2e2a05c785122 (patch) | |
| tree | b33fc248f12eae8dd82b98b630cad31e781b9daa /sys/amd64/include/asmacros.h | |
| parent | d05214e6b464ddb74055207965a5460e3014577b (diff) | |
Notes
Diffstat (limited to 'sys/amd64/include/asmacros.h')
| -rw-r--r-- | sys/amd64/include/asmacros.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sys/amd64/include/asmacros.h b/sys/amd64/include/asmacros.h new file mode 100644 index 000000000000..f0f2c014178c --- /dev/null +++ b/sys/amd64/include/asmacros.h @@ -0,0 +1,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 + |
