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: releng/10.3/sys/i386/include/asm.h 254463 2013-08-17 19:24:58Z jilles $ 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) 52254463Sjilles#define PIC_GOTOFF(x) x@GOTOFF(%ebx) 5323571Sbde#else 5423571Sbde#define PIC_PROLOGUE 5523571Sbde#define PIC_EPILOGUE 5623571Sbde#define PIC_PLT(x) x 57254463Sjilles#define PIC_GOTOFF(x) x 5823571Sbde#endif 5923571Sbde 6023571Sbde/* 6123571Sbde * CNAME and HIDENAME manage the relationship between symbol names in C 6223571Sbde * and the equivalent assembly language names. CNAME is given a name as 6323571Sbde * it would be used in a C program. It expands to the equivalent assembly 6423571Sbde * language name. HIDENAME is given an assembly-language name, and expands 6523571Sbde * to a possibly-modified form that will be invisible to C programs. 6623571Sbde */ 6723571Sbde#define CNAME(csym) csym 68115671Sobrien#define HIDENAME(asmsym) .asmsym 6923571Sbde 7025111Sbde/* XXX should use .p2align 4,0x90 for -m486. */ 7125111Sbde#define _START_ENTRY .text; .p2align 2,0x90 7223571Sbde 7325111Sbde#define _ENTRY(x) _START_ENTRY; \ 7425111Sbde .globl CNAME(x); .type CNAME(x),@function; CNAME(x): 75171914Sjkoshy#define END(x) .size x, . - x 7625111Sbde 7725111Sbde#ifdef PROF 7856581Sbde#define ALTENTRY(x) _ENTRY(x); \ 7925111Sbde pushl %ebp; movl %esp,%ebp; \ 8025111Sbde call PIC_PLT(HIDENAME(mcount)); \ 8156581Sbde popl %ebp; \ 8256581Sbde jmp 9f 8356581Sbde#define ENTRY(x) _ENTRY(x); \ 8456581Sbde pushl %ebp; movl %esp,%ebp; \ 8556581Sbde call PIC_PLT(HIDENAME(mcount)); \ 8656581Sbde popl %ebp; \ 8756581Sbde 9: 8823571Sbde#else 8956581Sbde#define ALTENTRY(x) _ENTRY(x) 9025111Sbde#define ENTRY(x) _ENTRY(x) 9123571Sbde#endif 9223571Sbde 93229367Sed/* 94229562Sed * WEAK_ALIAS: create a weak alias. 95229562Sed */ 96229562Sed#define WEAK_ALIAS(alias,sym) \ 97229562Sed .weak alias; \ 98229562Sed alias = sym 99229562Sed 100229562Sed/* 101229367Sed * STRONG_ALIAS: create a strong alias. 102229367Sed */ 103229367Sed#define STRONG_ALIAS(alias,sym) \ 104229367Sed .globl alias; \ 105229367Sed alias = sym 106229367Sed 10725111Sbde#define RCSID(x) .text; .asciz x 10823571Sbde 10992998Sobrien#undef __FBSDID 11092998Sobrien#if !defined(lint) && !defined(STRIP_FBSDID) 11192998Sobrien#define __FBSDID(s) .ident s 11292998Sobrien#else 11392998Sobrien#define __FBSDID(s) /* nothing */ 11492998Sobrien#endif /* not lint and not STRIP_FBSDID */ 11592998Sobrien 11625111Sbde#endif /* !_MACHINE_ASM_H_ */ 117