1 /* $NetBSD: asm.h,v 1.3 2006/07/07 06:42:32 cherry Exp $ */
4 * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
13 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
14 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
15 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 * Carnegie Mellon requests users of this software to return to
19 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
20 * School of Computer Science
21 * Carnegie Mellon University
22 * Pittsburgh PA 15213-3890
24 * any improvements or extensions that they make and grant Carnegie Mellon
25 * the rights to redistribute these changes.
29 * Assembly coding style
31 * This file contains macros and register defines to
32 * aid in writing more readable assembly code.
33 * Some rules to make assembly code understandable by
34 * a debugger are also noted.
38 * Macro to make a local label name.
40 #define LLABEL(name,num) L ## name ## num
47 alloc out0 = ar.pfs, 8, 0, 4, 0; \
51 br.call.sptk b0 = _mcount;;
53 #define MCOUNT /* nothing */
58 * Declare a global leaf function.
59 * A leaf function does not call other functions.
61 #define ENTRY(_name_, _n_args_) \
66 .regstk _n_args_, 0, 0, 0; \
69 #define ENTRY_NOPROFILE(_name_, _n_args_) \
74 .regstk _n_args_, 0, 0, 0
78 * Declare a local leaf function.
80 #define STATIC_ENTRY(_name_, _n_args_) \
84 .regstk _n_args_, 0, 0, 0 \
88 * Global alias for a leaf function, or alternate entry point
90 #define XENTRY(_name_) \
96 * Local alias for a leaf function, or alternate entry point
98 #define STATIC_XENTRY(_name_) \
106 #define END(_name_) \
114 #define EXPORT(_name_) \
121 * Make an external name visible, typecheck the size
123 #define IMPORT(_name_, _size_) \
124 /* .extern _name_,_size_ */
129 * Define an absolute symbol
131 #define ABS(_name_, _value_) \
138 * Allocate un-initialized space for a global symbol
140 #define BSS(_name_,_numbytes_) \
141 .comm _name_,_numbytes_
146 * Allocate space for a message (a read-only ascii string)
149 #define MSG(msg,reg,label) \
150 addl reg,@ltoff(label),gp;; \
160 #define SYSCALLNUM(name) ___CONCAT(SYS_,name)
162 #define CALLSYS_NOERROR(name) \
164 alloc r9 = ar.pfs, 0, 0, 8, 0 ; \
168 mov r8 = SYSCALLNUM(name) ; \
170 br.call.sptk b0 = b7 ;; }
174 * WEAK_ALIAS: create a weak alias (ELF only).
176 #define WEAK_ALIAS(alias,sym) \
181 * STRONG_ALIAS: create a strong alias.
183 #define STRONG_ALIAS(alias,sym) \