asm.h revision 1.2
11.2Scgd/*	$NetBSD: asm.h,v 1.2 1994/10/26 08:02:01 cgd Exp $	*/
21.2Scgd
31.1Sragge/*-
41.1Sragge * Copyright (c) 1990 The Regents of the University of California.
51.1Sragge * All rights reserved.
61.1Sragge *
71.1Sragge * This code is derived from software contributed to Berkeley by
81.1Sragge * William Jolitz.
91.1Sragge *
101.1Sragge * Redistribution and use in source and binary forms, with or without
111.1Sragge * modification, are permitted provided that the following conditions
121.1Sragge * are met:
131.1Sragge * 1. Redistributions of source code must retain the above copyright
141.1Sragge *    notice, this list of conditions and the following disclaimer.
151.1Sragge * 2. Redistributions in binary form must reproduce the above copyright
161.1Sragge *    notice, this list of conditions and the following disclaimer in the
171.1Sragge *    documentation and/or other materials provided with the distribution.
181.1Sragge * 3. All advertising materials mentioning features or use of this software
191.1Sragge *    must display the following acknowledgement:
201.1Sragge *	This product includes software developed by the University of
211.1Sragge *	California, Berkeley and its contributors.
221.1Sragge * 4. Neither the name of the University nor the names of its contributors
231.1Sragge *    may be used to endorse or promote products derived from this software
241.1Sragge *    without specific prior written permission.
251.1Sragge *
261.1Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271.1Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281.1Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291.1Sragge * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301.1Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311.1Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321.1Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331.1Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341.1Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351.1Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361.1Sragge * SUCH DAMAGE.
371.1Sragge *
381.2Scgd *	@(#)asm.h	5.5 (Berkeley) 5/7/91
391.1Sragge */
401.1Sragge
411.1Sragge#ifndef _SYS_ASM_H_
421.1Sragge#define _SYS_ASM_H_
431.1Sragge
441.1Sragge/*
451.1Sragge * XXX assumes that arguments are not passed in %eax
461.1Sragge */
471.1Sragge
481.1Sragge#ifdef PROF
491.1Sragge# define _BEGIN_ENTRY	.data; 1:; .long 0; .text; .align 2
501.1Sragge# define _END_ENTRY	moval 1b,r0; jsb mcount
511.1Sragge#else
521.1Sragge# define _BEGIN_ENTRY	.text; .align 2
531.1Sragge# define _END_ENTRY
541.1Sragge#endif
551.1Sragge
561.1Sragge#ifdef __STDC__
571.1Sragge# define _C_FUNC(x)	_ ## x
581.1Sragge#else
591.1Sragge# define _C_FUNC(x)	_/**/x
601.1Sragge#endif
611.1Sragge#define	_ASM_FUNC(x)	x
621.1Sragge
631.1Sragge#define _ENTRY(x)	.globl x; x:
641.1Sragge
651.1Sragge#define	ENTRY(y)	_BEGIN_ENTRY; _ENTRY(_C_FUNC(y)); _END_ENTRY
661.1Sragge#define	TWOENTRY(y,z)	_BEGIN_ENTRY; _ENTRY(_C_FUNC(y)); _ENTRY(_C_FUNC(z)); \
671.1Sragge			_END_ENTRY
681.1Sragge#define	ASENTRY(y)	_BEGIN_ENTRY; _ENTRY(_ASM_FUNC(y)); _END_ENTRY
691.1Sragge
701.1Sragge#define	ASMSTR		.asciz
711.1Sragge
721.1Sragge#endif /* !_SYS_ASM_H_ */
73