Removed definition "LIB= rpc". We want libc.a to contain librpc.a, not
[unix-history] / .ref-386BSD-0.1-patchkit / usr / src / sys.386bsd / i386 / boot / asm.h
CommitLineData
b3a00a53
JE
1/*
2 * Ported to Boot 386BSD by Julian Elsicher (julian@tfs.com) Sept. 1992
3 *
4 * Mach Operating System
5 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
6 * All Rights Reserved.
7 *
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.
13 *
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.
17 *
18 * Carnegie Mellon requests users of this software to return to
19 *
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
24 *
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
27 */
28/*
29 * HISTORY
30 * $Log: asm.h,v $
31 * Revision 2.7 92/02/29 15:33:41 rpd
32 * Added ENTRY2.
33 * [92/02/28 rpd]
34 *
35 * Revision 2.6 92/02/19 15:07:52 elf
36 * Changed #if __STDC__ to #ifdef __STDC__
37 * [92/01/16 jvh]
38 *
39 * Revision 2.5 91/05/14 16:02:45 mrt
40 * Correcting copyright
41 *
42 * Revision 2.4 91/02/05 17:10:42 mrt
43 * Changed to new Mach copyright
44 * [91/02/01 17:30:29 mrt]
45 *
46 * Revision 2.3 90/12/20 16:35:27 jeffreyh
47 * changes for __STDC__
48 * [90/12/06 jeffreyh]
49 *
50 * Revision 2.2 90/05/03 15:24:12 dbg
51 * First checkin.
52 *
53 *
54 * Typo on ENTRY if gprof
55 * [90/03/29 rvb]
56 *
57 * fix SVC for "ifdef wheeze" [kupfer]
58 * Fix the GPROF definitions.
59 * ENTRY(x) gets profiled iffdef GPROF.
60 * Entry(x) (and DATA(x)) is NEVER profiled.
61 * MCOUNT can be used by asm that intends to build a frame,
62 * after the frame is built.
63 * [90/02/26 rvb]
64 *
65 * Add #define addr16 .byte 0x67
66 * [90/02/09 rvb]
67 * Added LBi, SVC and ENTRY
68 * [89/11/10 09:51:33 rvb]
69 *
70 * New a.out and coff compatible .s files.
71 * [89/10/16 rvb]
72 */
73
74
75#define S_ARG0 4(%esp)
76#define S_ARG1 8(%esp)
77#define S_ARG2 12(%esp)
78#define S_ARG3 16(%esp)
79
80#define FRAME pushl %ebp; movl %esp, %ebp
81#define EMARF leave
82
83#define B_ARG0 8(%ebp)
84#define B_ARG1 12(%ebp)
85#define B_ARG2 16(%ebp)
86#define B_ARG3 20(%ebp)
87
88#ifdef wheeze
89
90#define ALIGN 4
91#define EXT(x) x
92#define LEXT(x) x:
93#define LCL(x) ./**/x
94
95#define LB(x,n) ./**/x
96#define LBb(x,n) ./**/x
97#define LBf(x,n) ./**/x
98
99#define SVC lcall $7,$0
100
101#define String .string
102#define Value .value
103#define Times(a,b) [a\*b]
104#define Divide(a,b) [a\\b]
105
106#define INB inb (%dx)
107#define OUTB outb (%dx)
108#define INL inl (%dx)
109#define OUTL outl (%dx)
110
111#else wheeze
112#define ALIGN
113#define LCL(x) x
114
115#define LB(x,n) n
116#ifdef __STDC__
117#define EXT(x) _ ## x
118#define LEXT(x) _ ## x ## :
119
120#define LBb(x,n) n ## b
121#define LBf(x,n) n ## f
122#else __STDC__
123#define EXT(x) _/**/x
124#define LEXT(x) _/**/x/**/:
125#define LBb(x,n) n/**/b
126#define LBf(x,n) n/**/f
127#endif __STDC__
128#define SVC .byte 0x9a; .long 0; .word 0x7
129
130#define String .ascii
131#define Value .word
132#define Times(a,b) (a*b)
133#define Divide(a,b) (a/b)
134
135#define INB inb %dx, %al
136#define OUTB outb %al, %dx
137#define INL inl %dx, %eax
138#define OUTL outl %eax, %dx
139
140#endif wheeze
141
142#define data32 .byte 0x66
143#define data16 .byte 0x66
144#define addr16 .byte 0x67
145
146
147
148#ifdef GPROF
149#ifdef __STDC__
150
151#define MCOUNT .data; LB(x, 9); .long 0; .text; lea LBb(x, 9),%edx; call mcount
152#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \
153 pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
154#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
155 .align ALIGN; LEXT(x) LEXT(y) ; \
156 pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
157#define ASENTRY(x) .globl x; .align ALIGN; x ## : ; \
158 pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
159
160#else __STDC__
161
162#define MCOUNT .data; LB(x, 9): .long 0; .text; lea LBb(x, 9),%edx; call mcount
163#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \
164 pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
165#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
166 .align ALIGN; LEXT(x) LEXT(y)
167#define ASENTRY(x) .globl x; .align ALIGN; x: ; \
168 pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
169
170#endif __STDC__
171#else GPROF
172#ifdef __STDC__
173
174#define MCOUNT
175#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x)
176#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
177 .align ALIGN; LEXT(x) LEXT(y)
178#define ASENTRY(x) .globl x; .align ALIGN; x ## :
179
180#else __STDC__
181
182#define MCOUNT
183#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x)
184#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
185 .align ALIGN; LEXT(x) LEXT(y)
186#define ASENTRY(x) .globl x; .align ALIGN; x:
187
188#endif __STDC__
189#endif GPROF
190
191#define Entry(x) .globl EXT(x); .align ALIGN; LEXT(x)
192#define DATA(x) .globl EXT(x); .align ALIGN; LEXT(x)