FreeBSD/Linux Kernel Cross Reference
sys/i386/asm.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: asm.h,v $
29 * Revision 2.9 93/05/10 17:46:19 rvb
30 * Define LCLL(x) "Local label" == x:
31 * Specify ALIGN == 2.
32 * [93/05/03 rvb]
33 *
34 * Revision 2.8 93/03/09 11:17:03 danner
35 * Flushed wheeze and fixed for gcc cpp.
36 * [93/03/03 mrt]
37 *
38 * Revision 2.7 92/02/29 15:33:41 rpd
39 * Added ENTRY2.
40 * [92/02/28 rpd]
41 *
42 * Revision 2.6 92/02/19 15:07:52 elf
43 * Changed #if __STDC__ to #ifdef __STDC__
44 * [92/01/16 jvh]
45 *
46 * Revision 2.5 91/05/14 16:02:45 mrt
47 * Correcting copyright
48 *
49 * Revision 2.4 91/02/05 17:10:42 mrt
50 * Changed to new Mach copyright
51 * [91/02/01 17:30:29 mrt]
52 *
53 * Revision 2.3 90/12/20 16:35:27 jeffreyh
54 * changes for __STDC__
55 * [90/12/06 jeffreyh]
56 *
57 * Revision 2.2 90/05/03 15:24:12 dbg
58 * First checkin.
59 *
60 *
61 * Typo on ENTRY if gprof
62 * [90/03/29 rvb]
63 *
64 * fix SVC for "ifdef wheeze" [kupfer]
65 * Fix the GPROF definitions.
66 * ENTRY(x) gets profiled iffdef GPROF.
67 * Entry(x) (and DATA(x)) is NEVER profiled.
68 * MCOUNT can be used by asm that intends to build a frame,
69 * after the frame is built.
70 * [90/02/26 rvb]
71 *
72 * Add #define addr16 .byte 0x67
73 * [90/02/09 rvb]
74 * Added LBi, SVC and ENTRY
75 * [89/11/10 09:51:33 rvb]
76 *
77 * New a.out and coff compatible .s files.
78 * [89/10/16 rvb]
79 */
80
81
82 #define S_ARG0 4(%esp)
83 #define S_ARG1 8(%esp)
84 #define S_ARG2 12(%esp)
85 #define S_ARG3 16(%esp)
86
87 #define FRAME pushl %ebp; movl %esp, %ebp
88 #define EMARF leave
89
90 #define B_ARG0 8(%ebp)
91 #define B_ARG1 12(%ebp)
92 #define B_ARG2 16(%ebp)
93 #define B_ARG3 20(%ebp)
94
95 #define ALIGN 2
96 #define LCL(x) x
97
98 #define LB(x,n) n
99 #ifdef __STDC__
100 #define EXT(x) _ ## x
101 #define LEXT(x) _ ## x ## :
102 #define LCLL(x) x ## :
103 #define gLB(n) n ## :
104 #define LBb(x,n) n ## b
105 #define LBf(x,n) n ## f
106 #else __STDC__
107 #define EXT(x) _/**/x
108 #define LEXT(x) _/**/x/**/:
109 #define LCLL(x) x/**/:
110 #define gLB(n) n/**/:
111 #define LBb(x,n) n/**/b
112 #define LBf(x,n) n/**/f
113 #endif __STDC__
114 #define SVC .byte 0x9a; .long 0; .word 0x7
115
116 #define String .ascii
117 #define Value .word
118 #define Times(a,b) (a*b)
119 #define Divide(a,b) (a/b)
120
121 #define INB inb %dx, %al
122 #define OUTB outb %al, %dx
123 #define INL inl %dx, %eax
124 #define OUTL outl %eax, %dx
125
126 #define data16 .byte 0x66
127 #define addr16 .byte 0x67
128
129
130
131 #ifdef GPROF
132
133 #define MCOUNT .data; gLB(9) .long 0; .text; lea LBb(x, 9),%edx; call mcount
134 #define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \
135 pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
136 #define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
137 .align ALIGN; LEXT(x) LEXT(y)
138 #define ASENTRY(x) .globl x; .align ALIGN; gLB(x) ; \
139 pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
140
141 #else GPROF
142
143 #define MCOUNT
144 #define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x)
145 #define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
146 .align ALIGN; LEXT(x) LEXT(y)
147 #define ASENTRY(x) .globl x; .align ALIGN; gLB(x)
148 #endif GPROF
149
150 #define Entry(x) .globl EXT(x); .align ALIGN; LEXT(x)
151 #define DATA(x) .globl EXT(x); .align ALIGN; LEXT(x)
Cache object: 37c5e32b5d30f2188e5036101ccca638
|