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 * %sccs.include.redist.c% 9 * 10 * @(#)machAsmDefs.h 7.2 (Berkeley) 02/29/92 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 * LEAF(x) 37 * 38 * Declare a leaf routine. 39 */ 40 #define LEAF(x) \ 41 .globl x; \ 42 .ent x, 0; \ 43 x: ; \ 44 .frame sp, 0, ra 45 46 /* 47 * ALEAF -- declare alternate entry to leaf routine 48 */ 49 #define ALEAF(x) \ 50 .globl x; \ 51 .aent x,0; \ 52 x: 53 54 /* 55 * NON_LEAF(x) 56 * 57 * Declare a non-leaf routine (a routine that makes other C calls). 58 */ 59 #define NON_LEAF(x, fsize, retpc) \ 60 .globl x; \ 61 .ent x, 0; \ 62 x: ; \ 63 .frame sp, fsize, retpc 64 65 /* 66 * END(x) 67 * 68 * Mark end of a procedure. 69 */ 70 #define END(x) \ 71 .end x 72 73 #define STAND_FRAME_SIZE 24 74 #define STAND_RA_OFFSET 20 75 76 /* 77 * Macros to panic and printf from assembly language. 78 */ 79 #define PANIC(msg) \ 80 la a0, 9f; \ 81 jal panic; \ 82 MSG(msg) 83 84 #define PRINTF(msg) \ 85 la a0, 9f; \ 86 jal printf; \ 87 MSG(msg) 88 89 #define MSG(msg) \ 90 .rdata; \ 91 9: .asciiz msg; \ 92 .text 93 94 #define ASMSTR(str) \ 95 .asciiz str; \ 96 .align 2 97 98 #endif /* _MACHASMDEFS */ 99