xref: /original-bsd/sys/pmax/include/machAsmDefs.h (revision 3705696b)
1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Ralph Campbell.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)machAsmDefs.h	8.1 (Berkeley) 06/10/93
11  */
12 
13 /*
14  * machAsmDefs.h --
15  *
16  *	Macros used when writing assembler programs.
17  *
18  *	Copyright (C) 1989 Digital Equipment Corporation.
19  *	Permission to use, copy, modify, and distribute this software and
20  *	its documentation for any purpose and without fee is hereby granted,
21  *	provided that the above copyright notice appears in all copies.
22  *	Digital Equipment Corporation makes no representations about the
23  *	suitability of this software for any purpose.  It is provided "as is"
24  *	without express or implied warranty.
25  *
26  * from: $Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsmDefs.h,
27  *	v 1.2 89/08/15 18:28:24 rab Exp $ SPRITE (DECWRL)
28  */
29 
30 #ifndef _MACHASMDEFS
31 #define _MACHASMDEFS
32 
33 #include <machine/regdef.h>
34 
35 /*
36  * Define -pg profile entry code.
37  */
38 #if defined(GPROF) || defined(PROF)
39 #define	MCOUNT	.set noreorder; \
40 		.set noat; \
41 		move $1,$31; \
42 		jal _mcount; \
43 		subu sp,sp,8; \
44 		.set reorder; \
45 		.set at;
46 #else
47 #define	MCOUNT
48 #endif
49 
50 /*
51  * LEAF(x)
52  *
53  *	Declare a leaf routine.
54  */
55 #define LEAF(x) \
56 	.globl x; \
57 	.ent x, 0; \
58 x: ; \
59 	.frame sp, 0, ra; \
60 	MCOUNT
61 
62 /*
63  * NLEAF(x)
64  *
65  *	Declare a non-profiled leaf routine.
66  */
67 #define NLEAF(x) \
68 	.globl x; \
69 	.ent x, 0; \
70 x: ; \
71 	.frame sp, 0, ra
72 
73 /*
74  * ALEAF -- declare alternate entry to a leaf routine.
75  */
76 #define	ALEAF(x)					\
77 	.globl	x;					\
78 	.aent	x,0;					\
79 x:
80 
81 /*
82  * NON_LEAF(x)
83  *
84  *	Declare a non-leaf routine (a routine that makes other C calls).
85  */
86 #define NON_LEAF(x, fsize, retpc) \
87 	.globl x; \
88 	.ent x, 0; \
89 x: ; \
90 	.frame sp, fsize, retpc; \
91 	MCOUNT
92 
93 /*
94  * NNON_LEAF(x)
95  *
96  *	Declare a non-profiled non-leaf routine
97  *	(a routine that makes other C calls).
98  */
99 #define NNON_LEAF(x, fsize, retpc) \
100 	.globl x; \
101 	.ent x, 0; \
102 x: ; \
103 	.frame sp, fsize, retpc
104 
105 /*
106  * END(x)
107  *
108  *	Mark end of a procedure.
109  */
110 #define END(x) \
111 	.end x
112 
113 #define STAND_FRAME_SIZE	24
114 #define STAND_RA_OFFSET		20
115 
116 /*
117  * Macros to panic and printf from assembly language.
118  */
119 #define PANIC(msg) \
120 	la	a0, 9f; \
121 	jal	panic; \
122 	MSG(msg)
123 
124 #define	PRINTF(msg) \
125 	la	a0, 9f; \
126 	jal	printf; \
127 	MSG(msg)
128 
129 #define	MSG(msg) \
130 	.rdata; \
131 9:	.asciiz	msg; \
132 	.text
133 
134 #define ASMSTR(str) \
135 	.asciiz str; \
136 	.align	2
137 
138 #endif /* _MACHASMDEFS */
139