xref: /csrg-svn/sys/pmax/include/machAsmDefs.h (revision 63217)
152131Smckusick /*
2*63217Sbostic  * Copyright (c) 1992, 1993
3*63217Sbostic  *	The Regents of the University of California.  All rights reserved.
452131Smckusick  *
552131Smckusick  * This code is derived from software contributed to Berkeley by
652131Smckusick  * Ralph Campbell.
752131Smckusick  *
852131Smckusick  * %sccs.include.redist.c%
952131Smckusick  *
10*63217Sbostic  *	@(#)machAsmDefs.h	8.1 (Berkeley) 06/10/93
1152703Sbostic  */
1252703Sbostic 
1352703Sbostic /*
1452131Smckusick  * machAsmDefs.h --
1552131Smckusick  *
1652131Smckusick  *	Macros used when writing assembler programs.
1752131Smckusick  *
1852131Smckusick  *	Copyright (C) 1989 Digital Equipment Corporation.
1952131Smckusick  *	Permission to use, copy, modify, and distribute this software and
2052131Smckusick  *	its documentation for any purpose and without fee is hereby granted,
2152131Smckusick  *	provided that the above copyright notice appears in all copies.
2252131Smckusick  *	Digital Equipment Corporation makes no representations about the
2352131Smckusick  *	suitability of this software for any purpose.  It is provided "as is"
2452131Smckusick  *	without express or implied warranty.
2552131Smckusick  *
2652131Smckusick  * from: $Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsmDefs.h,
2752131Smckusick  *	v 1.2 89/08/15 18:28:24 rab Exp $ SPRITE (DECWRL)
2852131Smckusick  */
2952131Smckusick 
3052131Smckusick #ifndef _MACHASMDEFS
3152131Smckusick #define _MACHASMDEFS
3252131Smckusick 
3352703Sbostic #include <machine/regdef.h>
3452703Sbostic 
3552131Smckusick /*
3658129Sralph  * Define -pg profile entry code.
3758129Sralph  */
3859829Sralph #if defined(GPROF) || defined(PROF)
3958129Sralph #define	MCOUNT	.set noreorder; \
4058129Sralph 		.set noat; \
4158129Sralph 		move $1,$31; \
4258281Sralph 		jal _mcount; \
4358281Sralph 		subu sp,sp,8; \
4458129Sralph 		.set reorder; \
4558129Sralph 		.set at;
4658129Sralph #else
4758129Sralph #define	MCOUNT
4859829Sralph #endif
4958129Sralph 
5058129Sralph /*
5152131Smckusick  * LEAF(x)
5252131Smckusick  *
5352131Smckusick  *	Declare a leaf routine.
5452131Smckusick  */
5552131Smckusick #define LEAF(x) \
5652131Smckusick 	.globl x; \
5752131Smckusick 	.ent x, 0; \
5852131Smckusick x: ; \
5958281Sralph 	.frame sp, 0, ra; \
6058129Sralph 	MCOUNT
6158129Sralph 
6258129Sralph /*
6358129Sralph  * NLEAF(x)
6458129Sralph  *
6558129Sralph  *	Declare a non-profiled leaf routine.
6658129Sralph  */
6758129Sralph #define NLEAF(x) \
6858129Sralph 	.globl x; \
6958129Sralph 	.ent x, 0; \
7058129Sralph x: ; \
7152131Smckusick 	.frame sp, 0, ra
7252131Smckusick 
7352131Smckusick /*
7458129Sralph  * ALEAF -- declare alternate entry to a leaf routine.
7552131Smckusick  */
7652131Smckusick #define	ALEAF(x)					\
7752131Smckusick 	.globl	x;					\
7852131Smckusick 	.aent	x,0;					\
7952131Smckusick x:
8052131Smckusick 
8152131Smckusick /*
8252131Smckusick  * NON_LEAF(x)
8352131Smckusick  *
8452131Smckusick  *	Declare a non-leaf routine (a routine that makes other C calls).
8552131Smckusick  */
8652131Smckusick #define NON_LEAF(x, fsize, retpc) \
8752131Smckusick 	.globl x; \
8852131Smckusick 	.ent x, 0; \
8952131Smckusick x: ; \
9058281Sralph 	.frame sp, fsize, retpc; \
9158129Sralph 	MCOUNT
9252131Smckusick 
9352131Smckusick /*
9459072Sralph  * NNON_LEAF(x)
9559072Sralph  *
9659072Sralph  *	Declare a non-profiled non-leaf routine
9759072Sralph  *	(a routine that makes other C calls).
9859072Sralph  */
9959072Sralph #define NNON_LEAF(x, fsize, retpc) \
10059072Sralph 	.globl x; \
10159072Sralph 	.ent x, 0; \
10259072Sralph x: ; \
10359072Sralph 	.frame sp, fsize, retpc
10459072Sralph 
10559072Sralph /*
10652131Smckusick  * END(x)
10752131Smckusick  *
10852131Smckusick  *	Mark end of a procedure.
10952131Smckusick  */
11052131Smckusick #define END(x) \
11152131Smckusick 	.end x
11252131Smckusick 
11352131Smckusick #define STAND_FRAME_SIZE	24
11452131Smckusick #define STAND_RA_OFFSET		20
11552131Smckusick 
11652131Smckusick /*
11752131Smckusick  * Macros to panic and printf from assembly language.
11852131Smckusick  */
11952131Smckusick #define PANIC(msg) \
12052131Smckusick 	la	a0, 9f; \
12152131Smckusick 	jal	panic; \
12252131Smckusick 	MSG(msg)
12352131Smckusick 
12452131Smckusick #define	PRINTF(msg) \
12552703Sbostic 	la	a0, 9f; \
12652131Smckusick 	jal	printf; \
12752131Smckusick 	MSG(msg)
12852131Smckusick 
12952131Smckusick #define	MSG(msg) \
13052131Smckusick 	.rdata; \
13152131Smckusick 9:	.asciiz	msg; \
13252131Smckusick 	.text
13352131Smckusick 
13452703Sbostic #define ASMSTR(str) \
13552703Sbostic 	.asciiz str; \
13652703Sbostic 	.align	2
13752703Sbostic 
13852131Smckusick #endif /* _MACHASMDEFS */
139