asm.h revision 1.2 1 1.2 glass /*-
2 1.2 glass * Copyright (c) 1990 The Regents of the University of California.
3 1.2 glass * All rights reserved.
4 1.2 glass *
5 1.2 glass * This version based on the old asm.h which is ifdef notdefed at the end,
6 1.2 glass * and jolitz's i386 asm.h mess.
7 1.2 glass *
8 1.2 glass * This code is derived from software contributed to Berkeley by
9 1.2 glass * William Jolitz.
10 1.2 glass *
11 1.2 glass * Redistribution and use in source and binary forms, with or without
12 1.2 glass * modification, are permitted provided that the following conditions
13 1.2 glass * are met:
14 1.2 glass * 1. Redistributions of source code must retain the above copyright
15 1.2 glass * notice, this list of conditions and the following disclaimer.
16 1.2 glass * 2. Redistributions in binary form must reproduce the above copyright
17 1.2 glass * notice, this list of conditions and the following disclaimer in the
18 1.2 glass * documentation and/or other materials provided with the distribution.
19 1.2 glass * 3. All advertising materials mentioning features or use of this software
20 1.2 glass * must display the following acknowledgement:
21 1.2 glass * This product includes software developed by the University of
22 1.2 glass * California, Berkeley and its contributors.
23 1.2 glass * 4. Neither the name of the University nor the names of its contributors
24 1.2 glass * may be used to endorse or promote products derived from this software
25 1.2 glass * without specific prior written permission.
26 1.2 glass *
27 1.2 glass * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 1.2 glass * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 1.2 glass * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 1.2 glass * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 1.2 glass * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 1.2 glass * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 1.2 glass * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 1.2 glass * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 1.2 glass * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 1.2 glass * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 1.2 glass * SUCH DAMAGE.
38 1.2 glass *
39 1.2 glass * from: @(#)asm.h 5.5 (Berkeley) 5/7/91
40 1.2 glass * asm.h,v 1.1 1993/06/16 21:42:47 mycroft Exp
41 1.2 glass */
42 1.2 glass
43 1.2 glass #ifndef _MACHINE_ASM_H_
44 1.2 glass #define _MACHINE_ASM_H_
45 1.2 glass
46 1.2 glass /*
47 1.2 glass * XXX assumes that arguments are not passed in %eax
48 1.2 glass */
49 1.2 glass
50 1.2 glass
51 1.2 glass #ifdef STDC
52 1.2 glass # define _C_FUNC(x) _ ## x
53 1.2 glass #else
54 1.2 glass # define _C_FUNC(x) _/**/x
55 1.2 glass #endif
56 1.2 glass #define _ASM_FUNC(x) x
57 1.2 glass
58 1.1 glass #ifdef GPROF
59 1.2 glass # define _BEGIN_ENTRY
60 1.2 glass # define _END_ENTRY link a6,#0; jbsr mcount; unlk a6 ;
61 1.2 glass # define _ENTER_FUNC(x) jra _C_FUNC(x)+12
62 1.2 glass #else
63 1.2 glass # define _BEGIN_ENTRY
64 1.2 glass # define _END_ENTRY
65 1.2 glass # define _ENTER_FUNC(x) ;
66 1.2 glass #endif
67 1.2 glass
68 1.2 glass #define _ENTRY(x) .globl x; x:
69 1.2 glass
70 1.2 glass #define ENTRY(y) _BEGIN_ENTRY; _ENTRY(_C_FUNC(y)); _END_ENTRY
71 1.2 glass #define TWOENTRY(y,z) _BEGIN_ENTRY; _ENTRY(_C_FUNC(z)); _END_ENTRY \
72 1.2 glass _ENTER_FUNC(y); \
73 1.2 glass _ENTRY(_C_FUNC(y)); _END_ENTRY
74 1.2 glass #define ASENTRY(y) _BEGIN_ENTRY; _ENTRY(_ASM_FUNC(y)); _END_ENTRY
75 1.2 glass
76 1.2 glass #define ASMSTR .asciz
77 1.2 glass
78 1.2 glass #endif /* !_MACHINE_ASM_H_ */
79 1.2 glass
80 1.2 glass #ifdef nodef
81 1.2 glass #ifdef PROF
82 1.1 glass #define ENTRY(name) \
83 1.1 glass .globl _/**/name; _/**/name: link a6,#0; jbsr mcount; unlk a6
84 1.1 glass #define ALTENTRY(name, rname) \
85 1.1 glass ENTRY(name); jra rname+12
86 1.1 glass #else
87 1.1 glass #define ENTRY(name) \
88 1.1 glass .globl _/**/name; _/**/name:
89 1.1 glass #define ALTENTRY(name, rname) \
90 1.1 glass .globl _/**/name; _/**/name:
91 1.2 glass #endif
92 1.1 glass #endif
93