asm.h revision 1.19
11.19Smatt/* $NetBSD: asm.h,v 1.19 2008/04/13 15:07:39 matt Exp $ */ 21.4Sragge/* 31.4Sragge * Copyright (c) 1982, 1993 41.4Sragge * The Regents of the University of California. All rights reserved. 51.1Sragge * 61.1Sragge * Redistribution and use in source and binary forms, with or without 71.1Sragge * modification, are permitted provided that the following conditions 81.1Sragge * are met: 91.1Sragge * 1. Redistributions of source code must retain the above copyright 101.1Sragge * notice, this list of conditions and the following disclaimer. 111.1Sragge * 2. Redistributions in binary form must reproduce the above copyright 121.1Sragge * notice, this list of conditions and the following disclaimer in the 131.1Sragge * documentation and/or other materials provided with the distribution. 141.16Sagc * 3. Neither the name of the University nor the names of its contributors 151.1Sragge * may be used to endorse or promote products derived from this software 161.1Sragge * without specific prior written permission. 171.1Sragge * 181.1Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 191.1Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 201.1Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 211.1Sragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 221.1Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 231.1Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 241.1Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 251.1Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 261.1Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 271.1Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 281.1Sragge * SUCH DAMAGE. 291.1Sragge * 301.4Sragge * @(#)DEFS.h 8.1 (Berkeley) 6/4/93 311.1Sragge */ 321.1Sragge 331.11Smatt#ifndef _VAX_ASM_H_ 341.11Smatt#define _VAX_ASM_H_ 351.1Sragge 361.4Sragge#define R0 0x001 371.4Sragge#define R1 0x002 381.4Sragge#define R2 0x004 391.4Sragge#define R3 0x008 401.4Sragge#define R4 0x010 411.4Sragge#define R5 0x020 421.4Sragge#define R6 0x040 431.11Smatt#define R7 0x080 441.11Smatt#define R8 0x100 451.11Smatt#define R9 0x200 461.11Smatt#define R10 0x400 471.11Smatt#define R11 0x800 481.11Smatt 491.11Smatt#ifdef __ELF__ 501.11Smatt# define _C_LABEL(x) x 511.11Smatt#else 521.11Smatt# ifdef __STDC__ 531.11Smatt# define _C_LABEL(x) _ ## x 541.11Smatt# else 551.11Smatt# define _C_LABEL(x) _/**/x 561.11Smatt# endif 571.11Smatt#endif 581.11Smatt 591.11Smatt#define _ASM_LABEL(x) x 601.1Sragge 611.3Sragge#ifdef __STDC__ 621.11Smatt# define __CONCAT(x,y) x ## y 631.11Smatt# define __STRING(x) #x 641.1Sragge#else 651.11Smatt# define __CONCAT(x,y) x/**/y 661.11Smatt# define __STRING(x) "x" 671.1Sragge#endif 681.11Smatt 691.11Smatt/* let kernels and others override entrypoint alignment */ 701.11Smatt#ifndef _ALIGN_TEXT 711.11Smatt# ifdef __ELF__ 721.11Smatt# define _ALIGN_TEXT .align 4 731.4Sragge# else 741.11Smatt# define _ALIGN_TEXT .align 2 751.11Smatt# endif 761.11Smatt#endif 771.11Smatt 781.11Smatt#define _ENTRY(x, regs) \ 791.11Smatt .text; _ALIGN_TEXT; .globl x; .type x@function; x: .word regs 801.11Smatt 811.5Sjtc#ifdef GPROF 821.11Smatt# ifdef __ELF__ 831.11Smatt# define _PROF_PROLOGUE \ 841.15Sthorpej .data; 1:; .long 0; .text; moval 1b,%r0; jsb _ASM_LABEL(__mcount) 851.11Smatt# else 861.11Smatt# define _PROF_PROLOGUE \ 871.11Smatt .data; 1:; .long 0; .text; moval 1b,r0; jsb _ASM_LABEL(mcount) 881.11Smatt# endif 891.4Sragge#else 901.11Smatt# define _PROF_PROLOGUE 911.10Skleink#endif 921.11Smatt 931.11Smatt#define ENTRY(x, regs) _ENTRY(_C_LABEL(x), regs); _PROF_PROLOGUE 941.11Smatt#define NENTRY(x, regs) _ENTRY(_C_LABEL(x), regs) 951.11Smatt#define ASENTRY(x, regs) _ENTRY(_ASM_LABEL(x), regs); _PROF_PROLOGUE 961.11Smatt 971.14Smatt#define ALTENTRY(x) .globl _C_LABEL(x); _C_LABEL(x): 981.19Smatt#define RCSID(name) .pushsection ".ident"; .asciz name; .popsection 991.19Smatt 1001.10Skleink 1011.14Smatt#ifdef __ELF__ 1021.10Skleink#define WEAK_ALIAS(alias,sym) \ 1031.10Skleink .weak alias; \ 1041.10Skleink alias = sym 1051.14Smatt#endif 1061.18Schristos/* 1071.18Schristos * STRONG_ALIAS: create a strong alias. 1081.18Schristos */ 1091.18Schristos#define STRONG_ALIAS(alias,sym) \ 1101.18Schristos .globl alias; \ 1111.18Schristos alias = sym 1121.7Sthorpej 1131.7Sthorpej#ifdef __STDC__ 1141.7Sthorpej#define WARN_REFERENCES(sym,msg) \ 1151.8Sthorpej .stabs msg ## ,30,0,0,0 ; \ 1161.11Smatt .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0 1171.7Sthorpej#else 1181.7Sthorpej#define WARN_REFERENCES(sym,msg) \ 1191.7Sthorpej .stabs msg,30,0,0,0 ; \ 1201.11Smatt .stabs __STRING(_C_LABEL(sym)),1,0,0,0 1211.7Sthorpej#endif /* __STDC__ */ 1221.1Sragge 1231.11Smatt#endif /* !_VAX_ASM_H_ */ 124