|
|
1.1 root 1: /*
2: * Ported to Boot 386BSD by Julian Elsicher ([email protected]) 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 [email protected]
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 1.1 1993/03/21 18:08:18 cgd
32: * after 0.2.2 "stable" patches applied
33: *
34: * Revision 2.7 92/02/29 15:33:41 rpd
35: * Added ENTRY2.
36: * [92/02/28 rpd]
37: *
38: * Revision 2.6 92/02/19 15:07:52 elf
39: * Changed #if __STDC__ to #ifdef __STDC__
40: * [92/01/16 jvh]
41: *
42: * Revision 2.5 91/05/14 16:02:45 mrt
43: * Correcting copyright
44: *
45: * Revision 2.4 91/02/05 17:10:42 mrt
46: * Changed to new Mach copyright
47: * [91/02/01 17:30:29 mrt]
48: *
49: * Revision 2.3 90/12/20 16:35:27 jeffreyh
50: * changes for __STDC__
51: * [90/12/06 jeffreyh]
52: *
53: * Revision 2.2 90/05/03 15:24:12 dbg
54: * First checkin.
55: *
56: *
57: * Typo on ENTRY if gprof
58: * [90/03/29 rvb]
59: *
60: * fix SVC for "ifdef wheeze" [kupfer]
61: * Fix the GPROF definitions.
62: * ENTRY(x) gets profiled iffdef GPROF.
63: * Entry(x) (and DATA(x)) is NEVER profiled.
64: * MCOUNT can be used by asm that intends to build a frame,
65: * after the frame is built.
66: * [90/02/26 rvb]
67: *
68: * Add #define addr16 .byte 0x67
69: * [90/02/09 rvb]
70: * Added LBi, SVC and ENTRY
71: * [89/11/10 09:51:33 rvb]
72: *
73: * New a.out and coff compatible .s files.
74: * [89/10/16 rvb]
75: */
76:
77:
78: #define S_ARG0 4(%esp)
79: #define S_ARG1 8(%esp)
80: #define S_ARG2 12(%esp)
81: #define S_ARG3 16(%esp)
82:
83: #define FRAME pushl %ebp; movl %esp, %ebp
84: #define EMARF leave
85:
86: #define B_ARG0 8(%ebp)
87: #define B_ARG1 12(%ebp)
88: #define B_ARG2 16(%ebp)
89: #define B_ARG3 20(%ebp)
90:
91: #ifdef wheeze
92:
93: #define ALIGN 4
94: #define EXT(x) x
95: #define LEXT(x) x:
96: #define LCL(x) ./**/x
97:
98: #define LB(x,n) ./**/x
99: #define LBb(x,n) ./**/x
100: #define LBf(x,n) ./**/x
101:
102: #define SVC lcall $7,$0
103:
104: #define String .string
105: #define Value .value
106: #define Times(a,b) [a\*b]
107: #define Divide(a,b) [a\\b]
108:
109: #define INB inb (%dx)
110: #define OUTB outb (%dx)
111: #define INL inl (%dx)
112: #define OUTL outl (%dx)
113:
114: #else wheeze
115: #define ALIGN
116: #define LCL(x) x
117:
118: #define LB(x,n) n
119: #ifdef __STDC__
120: #define EXT(x) _ ## x
121: #define LEXT(x) _ ## x ## :
122:
123: #define LBb(x,n) n ## b
124: #define LBf(x,n) n ## f
125: #else __STDC__
126: #define EXT(x) _/**/x
127: #define LEXT(x) _/**/x/**/:
128: #define LBb(x,n) n/**/b
129: #define LBf(x,n) n/**/f
130: #endif __STDC__
131: #define SVC .byte 0x9a; .long 0; .word 0x7
132:
133: #define String .ascii
134: #define Value .word
135: #define Times(a,b) (a*b)
136: #define Divide(a,b) (a/b)
137:
138: #define INB inb %dx, %al
139: #define OUTB outb %al, %dx
140: #define INL inl %dx, %eax
141: #define OUTL outl %eax, %dx
142:
143: #endif wheeze
144:
145: #define data32 .byte 0x66
146: #define data16 .byte 0x66
147: #define addr16 .byte 0x67
148:
149:
150:
151: #ifdef GPROF
152: #ifdef __STDC__
153:
154: #define MCOUNT .data; LB(x, 9); .long 0; .text; lea LBb(x, 9),%edx; call mcount
155: #define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \
156: pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
157: #define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
158: .align ALIGN; LEXT(x) LEXT(y) ; \
159: pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
160: #define ASENTRY(x) .globl x; .align ALIGN; x ## : ; \
161: pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
162:
163: #else __STDC__
164:
165: #define MCOUNT .data; LB(x, 9): .long 0; .text; lea LBb(x, 9),%edx; call mcount
166: #define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \
167: pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
168: #define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
169: .align ALIGN; LEXT(x) LEXT(y)
170: #define ASENTRY(x) .globl x; .align ALIGN; x: ; \
171: pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
172:
173: #endif __STDC__
174: #else GPROF
175: #ifdef __STDC__
176:
177: #define MCOUNT
178: #define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x)
179: #define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
180: .align ALIGN; LEXT(x) LEXT(y)
181: #define ASENTRY(x) .globl x; .align ALIGN; x ## :
182:
183: #else __STDC__
184:
185: #define MCOUNT
186: #define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x)
187: #define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
188: .align ALIGN; LEXT(x) LEXT(y)
189: #define ASENTRY(x) .globl x; .align ALIGN; x:
190:
191: #endif __STDC__
192: #endif GPROF
193:
194: #define Entry(x) .globl EXT(x); .align ALIGN; LEXT(x)
195: #define DATA(x) .globl EXT(x); .align ALIGN; LEXT(x)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.