1 /* 2 * Copyright (c) 1992 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Ralph Campbell. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. All advertising materials mentioning features or use of this software 17 * must display the following acknowledgement: 18 * This product includes software developed by the University of 19 * California, Berkeley and its contributors. 20 * 4. Neither the name of the University nor the names of its contributors 21 * may be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)machAsmDefs.h 7.4 (Berkeley) 2/26/93 37 */ 38 39 /* 40 * machAsmDefs.h -- 41 * 42 * Macros used when writing assembler programs. 43 * 44 * Copyright (C) 1989 Digital Equipment Corporation. 45 * Permission to use, copy, modify, and distribute this software and 46 * its documentation for any purpose and without fee is hereby granted, 47 * provided that the above copyright notice appears in all copies. 48 * Digital Equipment Corporation makes no representations about the 49 * suitability of this software for any purpose. It is provided "as is" 50 * without express or implied warranty. 51 * 52 * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsmDefs.h, 53 * v 1.2 89/08/15 18:28:24 rab Exp SPRITE (DECWRL) 54 * $Id: asm.h,v 1.1.1.1 1993/10/12 03:22:43 deraadt Exp $ 55 */ 56 57 #ifndef _MACHASMDEFS 58 #define _MACHASMDEFS 59 60 #include <machine/regdef.h> 61 62 /* 63 * Define -pg profile entry code. 64 */ 65 #ifdef PROF 66 #define MCOUNT .set noreorder; \ 67 .set noat; \ 68 move $1,$31; \ 69 jal _mcount; \ 70 subu sp,sp,8; \ 71 .set reorder; \ 72 .set at; 73 #else 74 #define MCOUNT 75 #endif PROF 76 77 /* 78 * LEAF(x) 79 * 80 * Declare a leaf routine. 81 */ 82 #define LEAF(x) \ 83 .globl x; \ 84 .ent x, 0; \ 85 x: ; \ 86 .frame sp, 0, ra; \ 87 MCOUNT 88 89 /* 90 * NLEAF(x) 91 * 92 * Declare a non-profiled leaf routine. 93 */ 94 #define NLEAF(x) \ 95 .globl x; \ 96 .ent x, 0; \ 97 x: ; \ 98 .frame sp, 0, ra 99 100 /* 101 * ALEAF -- declare alternate entry to a leaf routine. 102 */ 103 #define ALEAF(x) \ 104 .globl x; \ 105 .aent x,0; \ 106 x: 107 108 /* 109 * NON_LEAF(x) 110 * 111 * Declare a non-leaf routine (a routine that makes other C calls). 112 */ 113 #define NON_LEAF(x, fsize, retpc) \ 114 .globl x; \ 115 .ent x, 0; \ 116 x: ; \ 117 .frame sp, fsize, retpc; \ 118 MCOUNT 119 120 /* 121 * END(x) 122 * 123 * Mark end of a procedure. 124 */ 125 #define END(x) \ 126 .end x 127 128 #define STAND_FRAME_SIZE 24 129 #define STAND_RA_OFFSET 20 130 131 /* 132 * Macros to panic and printf from assembly language. 133 */ 134 #define PANIC(msg) \ 135 la a0, 9f; \ 136 jal panic; \ 137 MSG(msg) 138 139 #define PRINTF(msg) \ 140 la a0, 9f; \ 141 jal printf; \ 142 MSG(msg) 143 144 #define MSG(msg) \ 145 .rdata; \ 146 9: .asciiz msg; \ 147 .text 148 149 #define ASMSTR(str) \ 150 .asciiz str; \ 151 .align 2 152 153 #endif /* _MACHASMDEFS */ 154