2 /* From: NetBSD: asm.h,v 1.18 1997/11/03 04:22:06 ross Exp */
5 * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation.
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 * Carnegie Mellon requests users of this software to return to
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
30 * Assembly coding style
32 * This file contains macros and register defines to
33 * aid in writing more readable assembly code.
34 * Some rules to make assembly code understandable by
35 * a debugger are also noted.
39 * Macro to make a local label name.
41 #define LLABEL(name,num) L ## name ## num
46 #if defined(PROF) || (defined(_KERNEL) && defined(GPROF))
48 alloc out0 = ar.pfs, 8, 0, 4, 0; \
52 br.call.sptk b0 = _mcount;;
54 #define MCOUNT /* nothing */
59 * Declare a global leaf function.
60 * A leaf function does not call other functions.
62 #define ENTRY(_name_, _n_args_) \
67 .regstk _n_args_, 0, 0, 0; \
70 #define ENTRY_NOPROFILE(_name_, _n_args_) \
75 .regstk _n_args_, 0, 0, 0
79 * Declare a local leaf function.
81 #define STATIC_ENTRY(_name_, _n_args_) \
85 .regstk _n_args_, 0, 0, 0 \
89 * Global alias for a leaf function, or alternate entry point
91 #define XENTRY(_name_) \
97 * Local alias for a leaf function, or alternate entry point
99 #define STATIC_XENTRY(_name_) \
107 #define END(_name_) \
115 #define EXPORT(_name_) \
122 * Make an external name visible, typecheck the size
124 #define IMPORT(_name_, _size_) \
125 /* .extern _name_,_size_ */
130 * Define an absolute symbol
132 #define ABS(_name_, _value_) \
139 * Allocate un-initialized space for a global symbol
141 #define BSS(_name_,_numbytes_) \
142 .comm _name_,_numbytes_
147 * Allocate space for a message (a read-only ascii string)
150 #define MSG(msg,reg,label) \
151 addl reg,@ltoff(label),gp;; \
161 #define SYSCALLNUM(name) SYS_ ## name
163 #define CALLSYS_NOERROR(name) \
165 .unwabi @svr4, 'S' ; \
169 alloc r9 = ar.pfs, 0, 0, 8, 0 ; \
173 mov r8 = SYSCALLNUM(name) ; \
175 br.call.sptk b0 = b7 ;; }
179 * WEAK_ALIAS: create a weak alias (ELF only).
181 #define WEAK_ALIAS(alias,sym) \
188 #if !defined(lint) && !defined(STRIP_FBSDID)
189 #define __FBSDID(s) .ident s
191 #define __FBSDID(s) /* nothing */
192 #endif /* not lint and not STRIP_FBSDID */