1b2b3ffcdSSimon Schubert /*- 2b2b3ffcdSSimon Schubert * Copyright (c) 1990 The Regents of the University of California. 3b2b3ffcdSSimon Schubert * All rights reserved. 4b2b3ffcdSSimon Schubert * 5b2b3ffcdSSimon Schubert * This code is derived from software contributed to Berkeley by 6b2b3ffcdSSimon Schubert * William Jolitz. 7b2b3ffcdSSimon Schubert * 8b2b3ffcdSSimon Schubert * Redistribution and use in source and binary forms, with or without 9b2b3ffcdSSimon Schubert * modification, are permitted provided that the following conditions 10b2b3ffcdSSimon Schubert * are met: 11b2b3ffcdSSimon Schubert * 1. Redistributions of source code must retain the above copyright 12b2b3ffcdSSimon Schubert * notice, this list of conditions and the following disclaimer. 13b2b3ffcdSSimon Schubert * 2. Redistributions in binary form must reproduce the above copyright 14b2b3ffcdSSimon Schubert * notice, this list of conditions and the following disclaimer in the 15b2b3ffcdSSimon Schubert * documentation and/or other materials provided with the distribution. 162c64e990Szrj * 3. Neither the name of the University nor the names of its contributors 17b2b3ffcdSSimon Schubert * may be used to endorse or promote products derived from this software 18b2b3ffcdSSimon Schubert * without specific prior written permission. 19b2b3ffcdSSimon Schubert * 20b2b3ffcdSSimon Schubert * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21b2b3ffcdSSimon Schubert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22b2b3ffcdSSimon Schubert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23b2b3ffcdSSimon Schubert * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24b2b3ffcdSSimon Schubert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25b2b3ffcdSSimon Schubert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26b2b3ffcdSSimon Schubert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27b2b3ffcdSSimon Schubert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28b2b3ffcdSSimon Schubert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29b2b3ffcdSSimon Schubert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30b2b3ffcdSSimon Schubert * SUCH DAMAGE. 31b2b3ffcdSSimon Schubert * 32b2b3ffcdSSimon Schubert * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90 33b2b3ffcdSSimon Schubert * $FreeBSD: src/sys/amd64/include/asm.h,v 1.14 2003/06/02 05:59:35 peter Exp $ 34b2b3ffcdSSimon Schubert */ 35b2b3ffcdSSimon Schubert 36b2b3ffcdSSimon Schubert #ifndef _CPU_ASM_H_ 37b2b3ffcdSSimon Schubert #define _CPU_ASM_H_ 38b2b3ffcdSSimon Schubert 39b2b3ffcdSSimon Schubert #include <sys/cdefs.h> 40b2b3ffcdSSimon Schubert 41b2b3ffcdSSimon Schubert #ifdef PIC 42b2b3ffcdSSimon Schubert #define PIC_PLT(x) x@PLT 435a6cf1bbSImre Vadasz #if defined(__x86_64__) 44b2b3ffcdSSimon Schubert #define PIC_GOT(x) x@GOTPCREL(%rip) 45b2b3ffcdSSimon Schubert #else 465a6cf1bbSImre Vadasz #define PIC_PROLOGUE \ 475a6cf1bbSImre Vadasz pushl %ebx; \ 485a6cf1bbSImre Vadasz call 1f; \ 495a6cf1bbSImre Vadasz 1: \ 505a6cf1bbSImre Vadasz popl %ebx; \ 515a6cf1bbSImre Vadasz addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx 525a6cf1bbSImre Vadasz #define PIC_EPILOGUE \ 535a6cf1bbSImre Vadasz popl %ebx 545a6cf1bbSImre Vadasz #define PIC_GOT(x) x@GOT(%ebx) 555a6cf1bbSImre Vadasz #define PIC_GOTOFF(x) x@GOTOFF(%ebx) 565a6cf1bbSImre Vadasz #endif 575a6cf1bbSImre Vadasz #else 585a6cf1bbSImre Vadasz #if !defined(__x86_64__) 595a6cf1bbSImre Vadasz #define PIC_PROLOGUE 605a6cf1bbSImre Vadasz #define PIC_EPILOGUE 615a6cf1bbSImre Vadasz #define PIC_GOTOFF(x) x 625a6cf1bbSImre Vadasz #endif 63b2b3ffcdSSimon Schubert #define PIC_PLT(x) x 64b2b3ffcdSSimon Schubert #define PIC_GOT(x) x 65b2b3ffcdSSimon Schubert #endif 66b2b3ffcdSSimon Schubert 67*5b3646a9SMatthew Dillon #define ALIGN_DATA .p2align 3 /* 8 byte alignment, zero filled */ 68*5b3646a9SMatthew Dillon #define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ 69*5b3646a9SMatthew Dillon #define SUPERALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ 70*5b3646a9SMatthew Dillon 71b2b3ffcdSSimon Schubert /* 72b2b3ffcdSSimon Schubert * CNAME and HIDENAME manage the relationship between symbol names in C 73b2b3ffcdSSimon Schubert * and the equivalent assembly language names. CNAME is given a name as 74b2b3ffcdSSimon Schubert * it would be used in a C program. It expands to the equivalent assembly 75b2b3ffcdSSimon Schubert * language name. HIDENAME is given an assembly-language name, and expands 76b2b3ffcdSSimon Schubert * to a possibly-modified form that will be invisible to C programs. 77b2b3ffcdSSimon Schubert */ 78b2b3ffcdSSimon Schubert #define CNAME(csym) csym 79b2b3ffcdSSimon Schubert #define HIDENAME(asmsym) .asmsym 80b2b3ffcdSSimon Schubert 818508ec20Szrj #if defined(__x86_64__) 828508ec20Szrj #define _START_ENTRY .text; .p2align 4,0x90 838508ec20Szrj #else 84b2b3ffcdSSimon Schubert /* XXX should use .p2align 4,0x90 for -m486. */ 85b2b3ffcdSSimon Schubert #define _START_ENTRY .text; .p2align 2,0x90 868508ec20Szrj #endif 87b2b3ffcdSSimon Schubert 88b2b3ffcdSSimon Schubert #define _ENTRY(x) _START_ENTRY; \ 89b2b3ffcdSSimon Schubert .globl CNAME(x); .type CNAME(x),@function; CNAME(x): 90b2b3ffcdSSimon Schubert #define ALTENTRY(x) _ENTRY(x) 91b2b3ffcdSSimon Schubert #define ENTRY(x) _ENTRY(x) 92b2b3ffcdSSimon Schubert 93b2b3ffcdSSimon Schubert #define END(x) .size x, . - x 94b2b3ffcdSSimon Schubert 95b2b3ffcdSSimon Schubert #define RCSID(x) .text; .asciz x 96b2b3ffcdSSimon Schubert 97b2b3ffcdSSimon Schubert #endif /* !_CPU_ASM_H_ */ 98