asm.h revision 1.20
11.20Smatt/*	$NetBSD: asm.h,v 1.20 2008/08/29 18:25:01 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.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.20Smatt# define _ALIGN_TEXT .align 4
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.11Smatt# endif
731.4Sragge#else
741.11Smatt# define _PROF_PROLOGUE
751.10Skleink#endif
761.11Smatt
771.11Smatt#define ENTRY(x, regs)		_ENTRY(_C_LABEL(x), regs); _PROF_PROLOGUE
781.11Smatt#define NENTRY(x, regs)		_ENTRY(_C_LABEL(x), regs)
791.11Smatt#define ASENTRY(x, regs)	_ENTRY(_ASM_LABEL(x), regs); _PROF_PROLOGUE
801.11Smatt
811.14Smatt#define ALTENTRY(x)		.globl _C_LABEL(x); _C_LABEL(x):
821.19Smatt#define RCSID(name)		.pushsection ".ident"; .asciz name; .popsection
831.19Smatt
841.10Skleink
851.10Skleink#define	WEAK_ALIAS(alias,sym)						\
861.10Skleink	.weak alias;							\
871.10Skleink	alias = sym
881.20Smatt
891.18Schristos/*
901.18Schristos * STRONG_ALIAS: create a strong alias.
911.18Schristos */
921.18Schristos#define STRONG_ALIAS(alias,sym)						\
931.18Schristos	.globl alias;							\
941.18Schristos	alias = sym
951.7Sthorpej
961.7Sthorpej#ifdef __STDC__
971.7Sthorpej#define	WARN_REFERENCES(sym,msg)					\
981.8Sthorpej	.stabs msg ## ,30,0,0,0 ;					\
991.11Smatt	.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
1001.7Sthorpej#else
1011.7Sthorpej#define	WARN_REFERENCES(sym,msg)					\
1021.7Sthorpej	.stabs msg,30,0,0,0 ;						\
1031.11Smatt	.stabs __STRING(_C_LABEL(sym)),1,0,0,0
1041.7Sthorpej#endif /* __STDC__ */
1051.1Sragge
1061.11Smatt#endif /* !_VAX_ASM_H_ */
107