asm.h revision 1.11
11.11Smatt/*	$NetBSD: asm.h,v 1.11 2000/06/27 06:17:28 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.1Sragge * 3. All advertising materials mentioning features or use of this software
151.1Sragge *    must display the following acknowledgement:
161.1Sragge *	This product includes software developed by the University of
171.1Sragge *	California, Berkeley and its contributors.
181.1Sragge * 4. Neither the name of the University nor the names of its contributors
191.1Sragge *    may be used to endorse or promote products derived from this software
201.1Sragge *    without specific prior written permission.
211.1Sragge *
221.1Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231.1Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241.1Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251.1Sragge * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261.1Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271.1Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281.1Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291.1Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301.1Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311.1Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321.1Sragge * SUCH DAMAGE.
331.1Sragge *
341.4Sragge *	@(#)DEFS.h	8.1 (Berkeley) 6/4/93
351.1Sragge */
361.1Sragge
371.11Smatt#ifndef _VAX_ASM_H_
381.11Smatt#define _VAX_ASM_H_
391.1Sragge
401.4Sragge#define R0	0x001
411.4Sragge#define R1	0x002
421.4Sragge#define R2	0x004
431.4Sragge#define R3	0x008
441.4Sragge#define R4	0x010
451.4Sragge#define R5	0x020
461.4Sragge#define R6	0x040
471.11Smatt#define R7 	0x080
481.11Smatt#define R8	0x100
491.11Smatt#define R9	0x200
501.11Smatt#define R10	0x400
511.11Smatt#define R11	0x800
521.11Smatt
531.11Smatt#ifdef __ELF__
541.11Smatt# define _C_LABEL(x)	x
551.11Smatt#else
561.11Smatt# ifdef __STDC__
571.11Smatt#  define _C_LABEL(x)	_ ## x
581.11Smatt# else
591.11Smatt#  define _C_LABEL(x)	_/**/x
601.11Smatt# endif
611.11Smatt#endif
621.11Smatt
631.11Smatt#define	_ASM_LABEL(x)	x
641.1Sragge
651.3Sragge#ifdef __STDC__
661.11Smatt# define __CONCAT(x,y)	x ## y
671.11Smatt# define __STRING(x)	#x
681.1Sragge#else
691.11Smatt# define __CONCAT(x,y)	x/**/y
701.11Smatt# define __STRING(x)	"x"
711.1Sragge#endif
721.11Smatt
731.11Smatt/* let kernels and others override entrypoint alignment */
741.11Smatt#ifndef _ALIGN_TEXT
751.11Smatt# ifdef __ELF__
761.11Smatt#  define _ALIGN_TEXT .align 4
771.4Sragge# else
781.11Smatt#  define _ALIGN_TEXT .align 2
791.11Smatt# endif
801.11Smatt#endif
811.11Smatt
821.11Smatt#define	_ENTRY(x, regs) \
831.11Smatt	.text; _ALIGN_TEXT; .globl x; .type x@function; x: .word regs
841.11Smatt
851.5Sjtc#ifdef GPROF
861.11Smatt# ifdef __ELF__
871.11Smatt#  define _PROF_PROLOGUE	\
881.11Smatt	.data; 1:; .long 0; .text; moval 1b,r0; jsb _ASM_LABEL(__mcount)
891.11Smatt# else
901.11Smatt#  define _PROF_PROLOGUE	\
911.11Smatt	.data; 1:; .long 0; .text; moval 1b,r0; jsb _ASM_LABEL(mcount)
921.11Smatt# endif
931.4Sragge#else
941.11Smatt# define _PROF_PROLOGUE
951.10Skleink#endif
961.11Smatt
971.11Smatt#define ENTRY(x, regs)		_ENTRY(_C_LABEL(x), regs); _PROF_PROLOGUE
981.11Smatt#define NENTRY(x, regs)		_ENTRY(_C_LABEL(x), regs)
991.11Smatt#define ASENTRY(x, regs)	_ENTRY(_ASM_LABEL(x), regs); _PROF_PROLOGUE
1001.11Smatt
1011.11Smatt#define ALTENTRY(x)		.globl _C_LABEL(x); _C_LABEL(x):
1021.11Smatt#define RCSID(x)		.text; .asciz x
1031.10Skleink
1041.10Skleink#ifdef __ELF__
1051.10Skleink#define	WEAK_ALIAS(alias,sym)						\
1061.10Skleink	.weak alias;							\
1071.10Skleink	alias = sym
1081.1Sragge#endif
1091.7Sthorpej
1101.7Sthorpej#ifdef __STDC__
1111.7Sthorpej#define	WARN_REFERENCES(sym,msg)					\
1121.8Sthorpej	.stabs msg ## ,30,0,0,0 ;					\
1131.11Smatt	.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
1141.7Sthorpej#else
1151.7Sthorpej#define	WARN_REFERENCES(sym,msg)					\
1161.7Sthorpej	.stabs msg,30,0,0,0 ;						\
1171.11Smatt	.stabs __STRING(_C_LABEL(sym)),1,0,0,0
1181.7Sthorpej#endif /* __STDC__ */
1191.1Sragge
1201.11Smatt#endif /* !_VAX_ASM_H_ */
121