123571Sbde/*- 223571Sbde * Copyright (c) 1990 The Regents of the University of California. 323571Sbde * All rights reserved. 423571Sbde * 523571Sbde * This code is derived from software contributed to Berkeley by 623571Sbde * William Jolitz. 723571Sbde * 823571Sbde * Redistribution and use in source and binary forms, with or without 923571Sbde * modification, are permitted provided that the following conditions 1023571Sbde * are met: 1123571Sbde * 1. Redistributions of source code must retain the above copyright 1223571Sbde * notice, this list of conditions and the following disclaimer. 1323571Sbde * 2. Redistributions in binary form must reproduce the above copyright 1423571Sbde * notice, this list of conditions and the following disclaimer in the 1523571Sbde * documentation and/or other materials provided with the distribution. 1623571Sbde * 4. Neither the name of the University nor the names of its contributors 1723571Sbde * may be used to endorse or promote products derived from this software 1823571Sbde * without specific prior written permission. 1923571Sbde * 2023571Sbde * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2123571Sbde * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2223571Sbde * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2323571Sbde * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2423571Sbde * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2523571Sbde * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2623571Sbde * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2723571Sbde * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2823571Sbde * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2923571Sbde * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3023571Sbde * SUCH DAMAGE. 3123571Sbde * 3223571Sbde * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90 3350477Speter * $FreeBSD$ 3423571Sbde */ 3523571Sbde 3625111Sbde#ifndef _MACHINE_ASM_H_ 3725111Sbde#define _MACHINE_ASM_H_ 3825111Sbde 3923571Sbde#include <sys/cdefs.h> 4023571Sbde 4123571Sbde#ifdef PIC 4223571Sbde#define PIC_PROLOGUE \ 4323571Sbde pushl %ebx; \ 4423571Sbde call 1f; \ 4523571Sbde1: \ 4623571Sbde popl %ebx; \ 4723571Sbde addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx 4823571Sbde#define PIC_EPILOGUE \ 4923571Sbde popl %ebx 5023571Sbde#define PIC_PLT(x) x@PLT 5123571Sbde#define PIC_GOT(x) x@GOT(%ebx) 5223571Sbde#else 5323571Sbde#define PIC_PROLOGUE 5423571Sbde#define PIC_EPILOGUE 5523571Sbde#define PIC_PLT(x) x 5623571Sbde#define PIC_GOT(x) x 5723571Sbde#endif 5823571Sbde 5923571Sbde/* 6023571Sbde * CNAME and HIDENAME manage the relationship between symbol names in C 6123571Sbde * and the equivalent assembly language names. CNAME is given a name as 6223571Sbde * it would be used in a C program. It expands to the equivalent assembly 6323571Sbde * language name. HIDENAME is given an assembly-language name, and expands 6423571Sbde * to a possibly-modified form that will be invisible to C programs. 6523571Sbde */ 6623571Sbde#define CNAME(csym) csym 67115671Sobrien#define HIDENAME(asmsym) .asmsym 6823571Sbde 6925111Sbde/* XXX should use .p2align 4,0x90 for -m486. */ 7025111Sbde#define _START_ENTRY .text; .p2align 2,0x90 7123571Sbde 7225111Sbde#define _ENTRY(x) _START_ENTRY; \ 7325111Sbde .globl CNAME(x); .type CNAME(x),@function; CNAME(x): 74171914Sjkoshy#define END(x) .size x, . - x 7525111Sbde 7625111Sbde#ifdef PROF 7756581Sbde#define ALTENTRY(x) _ENTRY(x); \ 7825111Sbde pushl %ebp; movl %esp,%ebp; \ 7925111Sbde call PIC_PLT(HIDENAME(mcount)); \ 8056581Sbde popl %ebp; \ 8156581Sbde jmp 9f 8256581Sbde#define ENTRY(x) _ENTRY(x); \ 8356581Sbde pushl %ebp; movl %esp,%ebp; \ 8456581Sbde call PIC_PLT(HIDENAME(mcount)); \ 8556581Sbde popl %ebp; \ 8656581Sbde 9: 8723571Sbde#else 8856581Sbde#define ALTENTRY(x) _ENTRY(x) 8925111Sbde#define ENTRY(x) _ENTRY(x) 9023571Sbde#endif 9123571Sbde 9225111Sbde#define RCSID(x) .text; .asciz x 9323571Sbde 9492998Sobrien#undef __FBSDID 9592998Sobrien#if !defined(lint) && !defined(STRIP_FBSDID) 9692998Sobrien#define __FBSDID(s) .ident s 9792998Sobrien#else 9892998Sobrien#define __FBSDID(s) /* nothing */ 9992998Sobrien#endif /* not lint and not STRIP_FBSDID */ 10092998Sobrien 10125111Sbde#endif /* !_MACHINE_ASM_H_ */ 102