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