11.30Smartin/* $NetBSD: asm.h,v 1.30 2025/01/06 10:46:44 martin 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.20Smatt#define _C_LABEL(x) x 501.11Smatt 511.11Smatt#define _ASM_LABEL(x) x 521.1Sragge 531.3Sragge#ifdef __STDC__ 541.11Smatt# define __CONCAT(x,y) x ## y 551.11Smatt# define __STRING(x) #x 561.1Sragge#else 571.11Smatt# define __CONCAT(x,y) x/**/y 581.11Smatt# define __STRING(x) "x" 591.1Sragge#endif 601.11Smatt 611.11Smatt/* let kernels and others override entrypoint alignment */ 621.11Smatt#ifndef _ALIGN_TEXT 631.23Smatt# define _ALIGN_TEXT .p2align 2 641.11Smatt#endif 651.11Smatt 661.11Smatt#define _ENTRY(x, regs) \ 671.11Smatt .text; _ALIGN_TEXT; .globl x; .type x@function; x: .word regs 681.11Smatt 691.5Sjtc#ifdef GPROF 701.20Smatt# define _PROF_PROLOGUE \ 711.15Sthorpej .data; 1:; .long 0; .text; moval 1b,%r0; jsb _ASM_LABEL(__mcount) 721.4Sragge#else 731.11Smatt# define _PROF_PROLOGUE 741.10Skleink#endif 751.11Smatt 761.11Smatt#define ENTRY(x, regs) _ENTRY(_C_LABEL(x), regs); _PROF_PROLOGUE 771.11Smatt#define NENTRY(x, regs) _ENTRY(_C_LABEL(x), regs) 781.11Smatt#define ASENTRY(x, regs) _ENTRY(_ASM_LABEL(x), regs); _PROF_PROLOGUE 791.23Smatt#define END(x) .size _C_LABEL(x),.-_C_LABEL(x) 801.11Smatt 811.14Smatt#define ALTENTRY(x) .globl _C_LABEL(x); _C_LABEL(x): 821.29Smartin#ifdef _NETBSD_REVISIONID 831.29Smartin#define RCSID(x) .pushsection ".ident","MS",@progbits,1; \ 841.30Smartin .asciz x; \ 851.30Smartin .ascii "$"; .ascii "NetBSD: "; .ascii __FILE__; \ 861.30Smartin .ascii " "; .ascii _NETBSD_REVISIONID; \ 871.30Smartin .asciz " $"; \ 881.29Smartin .popsection 891.29Smartin#else 901.28Sjoerg#define RCSID(x) .pushsection ".ident","MS",@progbits,1; \ 911.28Sjoerg .asciz x; \ 921.28Sjoerg .popsection 931.29Smartin#endif 941.19Smatt 951.27Sragge#ifdef NO_KERNEL_RCSIDS 961.27Sragge#define __KERNEL_RCSID(_n, _s) /* nothing */ 971.27Sragge#else 981.27Sragge#define __KERNEL_RCSID(_n, _s) RCSID(_s) 991.27Sragge#endif 1001.10Skleink 1011.10Skleink#define WEAK_ALIAS(alias,sym) \ 1021.10Skleink .weak alias; \ 1031.10Skleink alias = sym 1041.20Smatt 1051.18Schristos/* 1061.18Schristos * STRONG_ALIAS: create a strong alias. 1071.18Schristos */ 1081.18Schristos#define STRONG_ALIAS(alias,sym) \ 1091.18Schristos .globl alias; \ 1101.18Schristos alias = sym 1111.7Sthorpej 1121.7Sthorpej#ifdef __STDC__ 1131.7Sthorpej#define WARN_REFERENCES(sym,msg) \ 1141.22Sjoerg .pushsection .gnu.warning. ## sym; \ 1151.22Sjoerg .ascii msg; \ 1161.22Sjoerg .popsection 1171.7Sthorpej#else 1181.7Sthorpej#define WARN_REFERENCES(sym,msg) \ 1191.22Sjoerg .pushsection .gnu.warning./**/sym; \ 1201.22Sjoerg .ascii msg; \ 1211.22Sjoerg .popsection 1221.7Sthorpej#endif /* __STDC__ */ 1231.1Sragge 1241.24Smatt.macro polyf arg:req degree:req tbladdr:req 1251.24Smatt movf \arg, %r1 1261.24Smatt movzwl \degree, %r2 1271.24Smatt movab \tbladdr, %r3 1281.24Smatt 1291.26Smatt movf (%r3)+, %r0 1301.24Smatt1: 1311.24Smatt mulf2 %r1, %r0 /* result *= arg */ 1321.25Smatt addf2 (%r3)+, %r0 /* result += c[n] */ 1331.24Smatt sobgtr %r2, 1b 1341.24Smatt clrf %r1 /* r1 is 0 on finish */ 1351.24Smatt.endm 1361.24Smatt 1371.24Smatt.macro polyd arg:req degree:req tbladdr:req 1381.24Smatt movd \arg, %r4 1391.24Smatt movzwl \degree, %r2 1401.24Smatt movab \tbladdr, %r3 1411.24Smatt 1421.26Smatt movd (%r3)+, %r0 1431.24Smatt1: 1441.24Smatt muld2 %r4, %r0 /* result *= arg */ 1451.25Smatt addd2 (%r3)+, %r0 /* result += c[n] */ 1461.24Smatt sobgtr %r2, 1b 1471.24Smatt clrq %r4 /* r4, r5 are 0 on finish */ 1481.24Smatt.endm 1491.24Smatt 1501.11Smatt#endif /* !_VAX_ASM_H_ */ 151