asm.h revision 1.3
11.3Sagc/* $NetBSD: asm.h,v 1.3 2003/08/07 16:26:36 agc Exp $ */ 21.1Sfvdl 31.1Sfvdl/*- 41.1Sfvdl * Copyright (c) 1990 The Regents of the University of California. 51.1Sfvdl * All rights reserved. 61.1Sfvdl * 71.1Sfvdl * This code is derived from software contributed to Berkeley by 81.1Sfvdl * William Jolitz. 91.1Sfvdl * 101.1Sfvdl * Redistribution and use in source and binary forms, with or without 111.1Sfvdl * modification, are permitted provided that the following conditions 121.1Sfvdl * are met: 131.1Sfvdl * 1. Redistributions of source code must retain the above copyright 141.1Sfvdl * notice, this list of conditions and the following disclaimer. 151.1Sfvdl * 2. Redistributions in binary form must reproduce the above copyright 161.1Sfvdl * notice, this list of conditions and the following disclaimer in the 171.1Sfvdl * documentation and/or other materials provided with the distribution. 181.3Sagc * 3. Neither the name of the University nor the names of its contributors 191.1Sfvdl * may be used to endorse or promote products derived from this software 201.1Sfvdl * without specific prior written permission. 211.1Sfvdl * 221.1Sfvdl * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231.1Sfvdl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241.1Sfvdl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251.1Sfvdl * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261.1Sfvdl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271.1Sfvdl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281.1Sfvdl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291.1Sfvdl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301.1Sfvdl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311.1Sfvdl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321.1Sfvdl * SUCH DAMAGE. 331.1Sfvdl * 341.1Sfvdl * @(#)asm.h 5.5 (Berkeley) 5/7/91 351.1Sfvdl */ 361.1Sfvdl 371.1Sfvdl#ifndef _AMD64_ASM_H_ 381.1Sfvdl#define _AMD64_ASM_H_ 391.1Sfvdl 401.1Sfvdl#ifdef PIC 411.1Sfvdl#define PIC_PLT(x) x@PLT 421.1Sfvdl#define PIC_GOT(x) x@GOTPCREL(%rip) 431.1Sfvdl#else 441.1Sfvdl#define PIC_PLT(x) x 451.1Sfvdl#define PIC_GOT(x) x 461.1Sfvdl#endif 471.1Sfvdl 481.1Sfvdl# define _C_LABEL(x) x 491.1Sfvdl#define _ASM_LABEL(x) x 501.1Sfvdl 511.1Sfvdl#define CVAROFF(x,y) (_C_LABEL(x)+y)(%rip) 521.1Sfvdl 531.1Sfvdl#ifdef __STDC__ 541.1Sfvdl# define __CONCAT(x,y) x ## y 551.1Sfvdl# define __STRING(x) #x 561.1Sfvdl#else 571.1Sfvdl# define __CONCAT(x,y) x/**/y 581.1Sfvdl# define __STRING(x) "x" 591.1Sfvdl#endif 601.1Sfvdl 611.1Sfvdl/* let kernels and others override entrypoint alignment */ 621.1Sfvdl#ifndef _ALIGN_TEXT 631.1Sfvdl#define _ALIGN_TEXT .align 4 641.1Sfvdl#endif 651.1Sfvdl 661.1Sfvdl#define _ENTRY(x) \ 671.1Sfvdl .text; _ALIGN_TEXT; .globl x; .type x,@function; x: 681.1Sfvdl 691.1Sfvdl#ifdef _KERNEL 701.1Sfvdl/* XXX Can't use __CONCAT() here, as it would be evaluated incorrectly. */ 711.1Sfvdl#ifdef __STDC__ 721.2Syamt#define IDTVEC(name) \ 731.2Syamt ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name: 741.1Sfvdl#else 751.2Syamt#define IDTVEC(name) \ 761.2Syamt ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name: 771.1Sfvdl#endif /* __STDC__ */ 781.1Sfvdl#endif /* _KERNEL */ 791.1Sfvdl 801.1Sfvdl#ifdef __STDC__ 811.1Sfvdl#define CPUVAR(off) %gs:CPU_INFO_ ## off 821.1Sfvdl#else 831.1Sfvdl#define CPUVAR(off) %gs:CPU_INFO_/**/off 841.1Sfvdl#endif 851.1Sfvdl 861.1Sfvdl 871.1Sfvdl#ifdef GPROF 881.1Sfvdl# define _PROF_PROLOGUE \ 891.1Sfvdl pushq %rbp; leaq (%rsp),%rbp; call PIC_PLT(__mcount); popq %rbp 901.1Sfvdl#else 911.1Sfvdl# define _PROF_PROLOGUE 921.1Sfvdl#endif 931.1Sfvdl 941.1Sfvdl#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE 951.1Sfvdl#define NENTRY(y) _ENTRY(_C_LABEL(y)) 961.1Sfvdl#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE 971.1Sfvdl 981.1Sfvdl#define ASMSTR .asciz 991.1Sfvdl 1001.1Sfvdl#define RCSID(x) .text; .asciz x 1011.1Sfvdl 1021.1Sfvdl#define WEAK_ALIAS(alias,sym) \ 1031.1Sfvdl .weak alias; \ 1041.1Sfvdl alias = sym 1051.1Sfvdl 1061.1Sfvdl/* XXXfvdl do not use stabs here */ 1071.1Sfvdl#ifdef __STDC__ 1081.1Sfvdl#define WARN_REFERENCES(sym,msg) \ 1091.1Sfvdl .stabs msg ## ,30,0,0,0 ; \ 1101.1Sfvdl .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0 1111.1Sfvdl#else 1121.1Sfvdl#define WARN_REFERENCES(sym,msg) \ 1131.1Sfvdl .stabs msg,30,0,0,0 ; \ 1141.1Sfvdl .stabs __STRING(sym),1,0,0,0 1151.1Sfvdl#endif /* __STDC__ */ 1161.1Sfvdl 1171.1Sfvdl#endif /* !_AMD64_ASM_H_ */ 118