4fa8d550349195a23ad97b7d2c0b7d3c0ad3f777
[coreboot.git] / util / x86emu / x86emu / prim_asm.h
1 /****************************************************************************
2 *
3 *                                               Realmode X86 Emulator Library
4 *
5 *               Copyright (C) 1996-1999 SciTech Software, Inc.
6 *                                    Copyright (C) David Mosberger-Tang
7 *                                          Copyright (C) 1999 Egbert Eich
8 *
9 *  ========================================================================
10 *
11 *  Permission to use, copy, modify, distribute, and sell this software and
12 *  its documentation for any purpose is hereby granted without fee,
13 *  provided that the above copyright notice appear in all copies and that
14 *  both that copyright notice and this permission notice appear in
15 *  supporting documentation, and that the name of the authors not be used
16 *  in advertising or publicity pertaining to distribution of the software
17 *  without specific, written prior permission.  The authors makes no
18 *  representations about the suitability of this software for any purpose.
19 *  It is provided "as is" without express or implied warranty.
20 *
21 *  THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
22 *  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
23 *  EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
24 *  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
25 *  USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26 *  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27 *  PERFORMANCE OF THIS SOFTWARE.
28 *
29 *  ========================================================================
30 *
31 * Language:             Watcom C++ 10.6 or later
32 * Environment:  Any
33 * Developer:    Kendall Bennett
34 *
35 * Description:  Inline assembler versions of the primitive operand
36 *                               functions for faster performance. At the moment this is
37 *                               x86 inline assembler, but these functions could be replaced
38 *                               with native inline assembler for each supported processor
39 *                               platform.
40 *
41 ****************************************************************************/
42 /* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/prim_asm.h,v 1.3 2000/04/19 15:48:15 tsi Exp $ */
43
44 #ifndef __X86EMU_PRIM_ASM_H
45 #define __X86EMU_PRIM_ASM_H
46
47 #ifdef  __WATCOMC__
48
49 #ifndef VALIDATE
50 #define __HAVE_INLINE_ASSEMBLER__
51 #endif
52
53 u32             get_flags_asm(void);
54 #pragma aux get_flags_asm =                     \
55         "pushf"                         \
56         "pop    eax"                    \
57         value [eax]                     \
58         modify exact [eax];
59
60 u16     aaa_word_asm(u32 *flags,u16 d);
61 #pragma aux aaa_word_asm =                      \
62         "push   [edi]"                          \
63         "popf"                          \
64         "aaa"                                   \
65         "pushf"                         \
66         "pop    [edi]"                          \
67         parm [edi] [ax]                                 \
68         value [ax]                      \
69         modify exact [ax];
70
71 u16     aas_word_asm(u32 *flags,u16 d);
72 #pragma aux aas_word_asm =                      \
73         "push   [edi]"                          \
74         "popf"                          \
75         "aas"                                   \
76         "pushf"                         \
77         "pop    [edi]"                          \
78         parm [edi] [ax]                                 \
79         value [ax]                      \
80         modify exact [ax];
81
82 u16     aad_word_asm(u32 *flags,u16 d);
83 #pragma aux aad_word_asm =                      \
84         "push   [edi]"                          \
85         "popf"                          \
86         "aad"                                   \
87         "pushf"                         \
88         "pop    [edi]"                          \
89         parm [edi] [ax]                                 \
90         value [ax]                      \
91         modify exact [ax];
92
93 u16     aam_word_asm(u32 *flags,u8 d);
94 #pragma aux aam_word_asm =                      \
95         "push   [edi]"                          \
96         "popf"                          \
97         "aam"                                   \
98         "pushf"                         \
99         "pop    [edi]"                          \
100         parm [edi] [al]                                 \
101         value [ax]                      \
102         modify exact [ax];
103
104 u8      adc_byte_asm(u32 *flags,u8 d, u8 s);
105 #pragma aux adc_byte_asm =                      \
106         "push   [edi]"                          \
107         "popf"                          \
108         "adc    al,bl"                  \
109         "pushf"                         \
110         "pop    [edi]"                          \
111         parm [edi] [al] [bl]            \
112         value [al]                      \
113         modify exact [al bl];
114
115 u16     adc_word_asm(u32 *flags,u16 d, u16 s);
116 #pragma aux adc_word_asm =                      \
117         "push   [edi]"                          \
118         "popf"                          \
119         "adc    ax,bx"                  \
120         "pushf"                         \
121         "pop    [edi]"                          \
122         parm [edi] [ax] [bx]            \
123         value [ax]                      \
124         modify exact [ax bx];
125
126 u32     adc_long_asm(u32 *flags,u32 d, u32 s);
127 #pragma aux adc_long_asm =                      \
128         "push   [edi]"                          \
129         "popf"                          \
130         "adc    eax,ebx"                \
131         "pushf"                         \
132         "pop    [edi]"                          \
133         parm [edi] [eax] [ebx]          \
134         value [eax]                     \
135         modify exact [eax ebx];
136
137 u8      add_byte_asm(u32 *flags,u8 d, u8 s);
138 #pragma aux add_byte_asm =                      \
139         "push   [edi]"                          \
140         "popf"                          \
141         "add    al,bl"                  \
142         "pushf"                         \
143         "pop    [edi]"                          \
144         parm [edi] [al] [bl]            \
145         value [al]                      \
146         modify exact [al bl];
147
148 u16     add_word_asm(u32 *flags,u16 d, u16 s);
149 #pragma aux add_word_asm =                      \
150         "push   [edi]"                          \
151         "popf"                          \
152         "add    ax,bx"                  \
153         "pushf"                         \
154         "pop    [edi]"                          \
155         parm [edi] [ax] [bx]            \
156         value [ax]                      \
157         modify exact [ax bx];
158
159 u32     add_long_asm(u32 *flags,u32 d, u32 s);
160 #pragma aux add_long_asm =                      \
161         "push   [edi]"                          \
162         "popf"                          \
163         "add    eax,ebx"                \
164         "pushf"                         \
165         "pop    [edi]"                          \
166         parm [edi] [eax] [ebx]          \
167         value [eax]                     \
168         modify exact [eax ebx];
169
170 u8      and_byte_asm(u32 *flags,u8 d, u8 s);
171 #pragma aux and_byte_asm =                      \
172         "push   [edi]"                          \
173         "popf"                          \
174         "and    al,bl"                  \
175         "pushf"                         \
176         "pop    [edi]"                          \
177         parm [edi] [al] [bl]            \
178         value [al]                      \
179         modify exact [al bl];
180
181 u16     and_word_asm(u32 *flags,u16 d, u16 s);
182 #pragma aux and_word_asm =                      \
183         "push   [edi]"                          \
184         "popf"                          \
185         "and    ax,bx"                  \
186         "pushf"                         \
187         "pop    [edi]"                          \
188         parm [edi] [ax] [bx]            \
189         value [ax]                      \
190         modify exact [ax bx];
191
192 u32     and_long_asm(u32 *flags,u32 d, u32 s);
193 #pragma aux and_long_asm =                      \
194         "push   [edi]"                          \
195         "popf"                          \
196         "and    eax,ebx"                \
197         "pushf"                         \
198         "pop    [edi]"                          \
199         parm [edi] [eax] [ebx]          \
200         value [eax]                     \
201         modify exact [eax ebx];
202
203 u8      cmp_byte_asm(u32 *flags,u8 d, u8 s);
204 #pragma aux cmp_byte_asm =                      \
205         "push   [edi]"                          \
206         "popf"                          \
207         "cmp    al,bl"                  \
208         "pushf"                         \
209         "pop    [edi]"                          \
210         parm [edi] [al] [bl]            \
211         value [al]                      \
212         modify exact [al bl];
213
214 u16     cmp_word_asm(u32 *flags,u16 d, u16 s);
215 #pragma aux cmp_word_asm =                      \
216         "push   [edi]"                          \
217         "popf"                          \
218         "cmp    ax,bx"                  \
219         "pushf"                         \
220         "pop    [edi]"                          \
221         parm [edi] [ax] [bx]            \
222         value [ax]                      \
223         modify exact [ax bx];
224
225 u32     cmp_long_asm(u32 *flags,u32 d, u32 s);
226 #pragma aux cmp_long_asm =                      \
227         "push   [edi]"                          \
228         "popf"                          \
229         "cmp    eax,ebx"                \
230         "pushf"                         \
231         "pop    [edi]"                          \
232         parm [edi] [eax] [ebx]          \
233         value [eax]                     \
234         modify exact [eax ebx];
235
236 u8      daa_byte_asm(u32 *flags,u8 d);
237 #pragma aux daa_byte_asm =                      \
238         "push   [edi]"                          \
239         "popf"                          \
240         "daa"                                   \
241         "pushf"                         \
242         "pop    [edi]"                          \
243         parm [edi] [al]                         \
244         value [al]                      \
245         modify exact [al];
246
247 u8      das_byte_asm(u32 *flags,u8 d);
248 #pragma aux das_byte_asm =                      \
249         "push   [edi]"                          \
250         "popf"                          \
251         "das"                                   \
252         "pushf"                         \
253         "pop    [edi]"                          \
254         parm [edi] [al]                         \
255         value [al]                      \
256         modify exact [al];
257
258 u8      dec_byte_asm(u32 *flags,u8 d);
259 #pragma aux dec_byte_asm =                      \
260         "push   [edi]"                          \
261         "popf"                          \
262         "dec    al"                     \
263         "pushf"                         \
264         "pop    [edi]"                          \
265         parm [edi] [al]                         \
266         value [al]                      \
267         modify exact [al];
268
269 u16     dec_word_asm(u32 *flags,u16 d);
270 #pragma aux dec_word_asm =                      \
271         "push   [edi]"                          \
272         "popf"                          \
273         "dec    ax"                     \
274         "pushf"                         \
275         "pop    [edi]"                          \
276         parm [edi] [ax]                         \
277         value [ax]                      \
278         modify exact [ax];
279
280 u32     dec_long_asm(u32 *flags,u32 d);
281 #pragma aux dec_long_asm =                      \
282         "push   [edi]"                          \
283         "popf"                          \
284         "dec    eax"                    \
285         "pushf"                         \
286         "pop    [edi]"                          \
287         parm [edi] [eax]                        \
288         value [eax]                     \
289         modify exact [eax];
290
291 u8      inc_byte_asm(u32 *flags,u8 d);
292 #pragma aux inc_byte_asm =                      \
293         "push   [edi]"                          \
294         "popf"                          \
295         "inc    al"                     \
296         "pushf"                         \
297         "pop    [edi]"                          \
298         parm [edi] [al]                         \
299         value [al]                      \
300         modify exact [al];
301
302 u16     inc_word_asm(u32 *flags,u16 d);
303 #pragma aux inc_word_asm =                      \
304         "push   [edi]"                          \
305         "popf"                          \
306         "inc    ax"                     \
307         "pushf"                         \
308         "pop    [edi]"                          \
309         parm [edi] [ax]                         \
310         value [ax]                      \
311         modify exact [ax];
312
313 u32     inc_long_asm(u32 *flags,u32 d);
314 #pragma aux inc_long_asm =                      \
315         "push   [edi]"                          \
316         "popf"                          \
317         "inc    eax"                    \
318         "pushf"                         \
319         "pop    [edi]"                          \
320         parm [edi] [eax]                        \
321         value [eax]                     \
322         modify exact [eax];
323
324 u8      or_byte_asm(u32 *flags,u8 d, u8 s);
325 #pragma aux or_byte_asm =                       \
326         "push   [edi]"                          \
327         "popf"                          \
328         "or     al,bl"                          \
329         "pushf"                         \
330         "pop    [edi]"                          \
331         parm [edi] [al] [bl]            \
332         value [al]                      \
333         modify exact [al bl];
334
335 u16     or_word_asm(u32 *flags,u16 d, u16 s);
336 #pragma aux or_word_asm =                       \
337         "push   [edi]"                          \
338         "popf"                          \
339         "or     ax,bx"                          \
340         "pushf"                         \
341         "pop    [edi]"                          \
342         parm [edi] [ax] [bx]            \
343         value [ax]                      \
344         modify exact [ax bx];
345
346 u32     or_long_asm(u32 *flags,u32 d, u32 s);
347 #pragma aux or_long_asm =                       \
348         "push   [edi]"                          \
349         "popf"                          \
350         "or     eax,ebx"                        \
351         "pushf"                         \
352         "pop    [edi]"                          \
353         parm [edi] [eax] [ebx]          \
354         value [eax]                     \
355         modify exact [eax ebx];
356
357 u8      neg_byte_asm(u32 *flags,u8 d);
358 #pragma aux neg_byte_asm =                      \
359         "push   [edi]"                          \
360         "popf"                          \
361         "neg    al"                     \
362         "pushf"                         \
363         "pop    [edi]"                          \
364         parm [edi] [al]                         \
365         value [al]                      \
366         modify exact [al];
367
368 u16     neg_word_asm(u32 *flags,u16 d);
369 #pragma aux neg_word_asm =                      \
370         "push   [edi]"                          \
371         "popf"                          \
372         "neg    ax"                     \
373         "pushf"                         \
374         "pop    [edi]"                          \
375         parm [edi] [ax]                         \
376         value [ax]                      \
377         modify exact [ax];
378
379 u32     neg_long_asm(u32 *flags,u32 d);
380 #pragma aux neg_long_asm =                      \
381         "push   [edi]"                          \
382         "popf"                          \
383         "neg    eax"                    \
384         "pushf"                         \
385         "pop    [edi]"                          \
386         parm [edi] [eax]                        \
387         value [eax]                     \
388         modify exact [eax];
389
390 u8      not_byte_asm(u32 *flags,u8 d);
391 #pragma aux not_byte_asm =                      \
392         "push   [edi]"                          \
393         "popf"                          \
394         "not    al"                     \
395         "pushf"                         \
396         "pop    [edi]"                          \
397         parm [edi] [al]                         \
398         value [al]                      \
399         modify exact [al];
400
401 u16     not_word_asm(u32 *flags,u16 d);
402 #pragma aux not_word_asm =                      \
403         "push   [edi]"                          \
404         "popf"                          \
405         "not    ax"                     \
406         "pushf"                         \
407         "pop    [edi]"                          \
408         parm [edi] [ax]                         \
409         value [ax]                      \
410         modify exact [ax];
411
412 u32     not_long_asm(u32 *flags,u32 d);
413 #pragma aux not_long_asm =                      \
414         "push   [edi]"                          \
415         "popf"                          \
416         "not    eax"                    \
417         "pushf"                         \
418         "pop    [edi]"                          \
419         parm [edi] [eax]                        \
420         value [eax]                     \
421         modify exact [eax];
422
423 u8      rcl_byte_asm(u32 *flags,u8 d, u8 s);
424 #pragma aux rcl_byte_asm =                      \
425         "push   [edi]"                          \
426         "popf"                          \
427         "rcl    al,cl"                  \
428         "pushf"                         \
429         "pop    [edi]"                          \
430         parm [edi] [al] [cl]            \
431         value [al]                      \
432         modify exact [al cl];
433
434 u16     rcl_word_asm(u32 *flags,u16 d, u8 s);
435 #pragma aux rcl_word_asm =                      \
436         "push   [edi]"                          \
437         "popf"                          \
438         "rcl    ax,cl"                  \
439         "pushf"                         \
440         "pop    [edi]"                          \
441         parm [edi] [ax] [cl]            \
442         value [ax]                      \
443         modify exact [ax cl];
444
445 u32     rcl_long_asm(u32 *flags,u32 d, u8 s);
446 #pragma aux rcl_long_asm =                      \
447         "push   [edi]"                          \
448         "popf"                          \
449         "rcl    eax,cl"                 \
450         "pushf"                         \
451         "pop    [edi]"                          \
452         parm [edi] [eax] [cl]           \
453         value [eax]                     \
454         modify exact [eax cl];
455
456 u8      rcr_byte_asm(u32 *flags,u8 d, u8 s);
457 #pragma aux rcr_byte_asm =                      \
458         "push   [edi]"                          \
459         "popf"                          \
460         "rcr    al,cl"                  \
461         "pushf"                         \
462         "pop    [edi]"                          \
463         parm [edi] [al] [cl]            \
464         value [al]                      \
465         modify exact [al cl];
466
467 u16     rcr_word_asm(u32 *flags,u16 d, u8 s);
468 #pragma aux rcr_word_asm =                      \
469         "push   [edi]"                          \
470         "popf"                          \
471         "rcr    ax,cl"                  \
472         "pushf"                         \
473         "pop    [edi]"                          \
474         parm [edi] [ax] [cl]            \
475         value [ax]                      \
476         modify exact [ax cl];
477
478 u32     rcr_long_asm(u32 *flags,u32 d, u8 s);
479 #pragma aux rcr_long_asm =                      \
480         "push   [edi]"                          \
481         "popf"                          \
482         "rcr    eax,cl"                 \
483         "pushf"                         \
484         "pop    [edi]"                          \
485         parm [edi] [eax] [cl]           \
486         value [eax]                     \
487         modify exact [eax cl];
488
489 u8      rol_byte_asm(u32 *flags,u8 d, u8 s);
490 #pragma aux rol_byte_asm =                      \
491         "push   [edi]"                          \
492         "popf"                          \
493         "rol    al,cl"                  \
494         "pushf"                         \
495         "pop    [edi]"                          \
496         parm [edi] [al] [cl]            \
497         value [al]                      \
498         modify exact [al cl];
499
500 u16     rol_word_asm(u32 *flags,u16 d, u8 s);
501 #pragma aux rol_word_asm =                      \
502         "push   [edi]"                          \
503         "popf"                          \
504         "rol    ax,cl"                  \
505         "pushf"                         \
506         "pop    [edi]"                          \
507         parm [edi] [ax] [cl]            \
508         value [ax]                      \
509         modify exact [ax cl];
510
511 u32     rol_long_asm(u32 *flags,u32 d, u8 s);
512 #pragma aux rol_long_asm =                      \
513         "push   [edi]"                          \
514         "popf"                          \
515         "rol    eax,cl"                 \
516         "pushf"                         \
517         "pop    [edi]"                          \
518         parm [edi] [eax] [cl]           \
519         value [eax]                     \
520         modify exact [eax cl];
521
522 u8      ror_byte_asm(u32 *flags,u8 d, u8 s);
523 #pragma aux ror_byte_asm =                      \
524         "push   [edi]"                          \
525         "popf"                          \
526         "ror    al,cl"                  \
527         "pushf"                         \
528         "pop    [edi]"                          \
529         parm [edi] [al] [cl]            \
530         value [al]                      \
531         modify exact [al cl];
532
533 u16     ror_word_asm(u32 *flags,u16 d, u8 s);
534 #pragma aux ror_word_asm =                      \
535         "push   [edi]"                          \
536         "popf"                          \
537         "ror    ax,cl"                  \
538         "pushf"                         \
539         "pop    [edi]"                          \
540         parm [edi] [ax] [cl]            \
541         value [ax]                      \
542         modify exact [ax cl];
543
544 u32     ror_long_asm(u32 *flags,u32 d, u8 s);
545 #pragma aux ror_long_asm =                      \
546         "push   [edi]"                          \
547         "popf"                          \
548         "ror    eax,cl"                 \
549         "pushf"                         \
550         "pop    [edi]"                          \
551         parm [edi] [eax] [cl]           \
552         value [eax]                     \
553         modify exact [eax cl];
554
555 u8      shl_byte_asm(u32 *flags,u8 d, u8 s);
556 #pragma aux shl_byte_asm =                      \
557         "push   [edi]"                          \
558         "popf"                          \
559         "shl    al,cl"                  \
560         "pushf"                         \
561         "pop    [edi]"                          \
562         parm [edi] [al] [cl]            \
563         value [al]                      \
564         modify exact [al cl];
565
566 u16     shl_word_asm(u32 *flags,u16 d, u8 s);
567 #pragma aux shl_word_asm =                      \
568         "push   [edi]"                          \
569         "popf"                          \
570         "shl    ax,cl"                  \
571         "pushf"                         \
572         "pop    [edi]"                          \
573         parm [edi] [ax] [cl]            \
574         value [ax]                      \
575         modify exact [ax cl];
576
577 u32     shl_long_asm(u32 *flags,u32 d, u8 s);
578 #pragma aux shl_long_asm =                      \
579         "push   [edi]"                          \
580         "popf"                          \
581         "shl    eax,cl"                 \
582         "pushf"                         \
583         "pop    [edi]"                          \
584         parm [edi] [eax] [cl]           \
585         value [eax]                     \
586         modify exact [eax cl];
587
588 u8      shr_byte_asm(u32 *flags,u8 d, u8 s);
589 #pragma aux shr_byte_asm =                      \
590         "push   [edi]"                          \
591         "popf"                          \
592         "shr    al,cl"                  \
593         "pushf"                         \
594         "pop    [edi]"                          \
595         parm [edi] [al] [cl]            \
596         value [al]                      \
597         modify exact [al cl];
598
599 u16     shr_word_asm(u32 *flags,u16 d, u8 s);
600 #pragma aux shr_word_asm =                      \
601         "push   [edi]"                          \
602         "popf"                          \
603         "shr    ax,cl"                  \
604         "pushf"                         \
605         "pop    [edi]"                          \
606         parm [edi] [ax] [cl]            \
607         value [ax]                      \
608         modify exact [ax cl];
609
610 u32     shr_long_asm(u32 *flags,u32 d, u8 s);
611 #pragma aux shr_long_asm =                      \
612         "push   [edi]"                          \
613         "popf"                          \
614         "shr    eax,cl"                 \
615         "pushf"                         \
616         "pop    [edi]"                          \
617         parm [edi] [eax] [cl]           \
618         value [eax]                     \
619         modify exact [eax cl];
620
621 u8      sar_byte_asm(u32 *flags,u8 d, u8 s);
622 #pragma aux sar_byte_asm =                      \
623         "push   [edi]"                          \
624         "popf"                          \
625         "sar    al,cl"                  \
626         "pushf"                         \
627         "pop    [edi]"                          \
628         parm [edi] [al] [cl]            \
629         value [al]                      \
630         modify exact [al cl];
631
632 u16     sar_word_asm(u32 *flags,u16 d, u8 s);
633 #pragma aux sar_word_asm =                      \
634         "push   [edi]"                          \
635         "popf"                          \
636         "sar    ax,cl"                  \
637         "pushf"                         \
638         "pop    [edi]"                          \
639         parm [edi] [ax] [cl]            \
640         value [ax]                      \
641         modify exact [ax cl];
642
643 u32     sar_long_asm(u32 *flags,u32 d, u8 s);
644 #pragma aux sar_long_asm =                      \
645         "push   [edi]"                          \
646         "popf"                          \
647         "sar    eax,cl"                 \
648         "pushf"                         \
649         "pop    [edi]"                          \
650         parm [edi] [eax] [cl]           \
651         value [eax]                     \
652         modify exact [eax cl];
653
654 u16             shld_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
655 #pragma aux shld_word_asm =                     \
656         "push   [edi]"                          \
657         "popf"                          \
658         "shld   ax,dx,cl"               \
659         "pushf"                         \
660         "pop    [edi]"                          \
661         parm [edi] [ax] [dx] [cl]       \
662         value [ax]                      \
663         modify exact [ax dx cl];
664
665 u32     shld_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
666 #pragma aux shld_long_asm =                     \
667         "push   [edi]"                          \
668         "popf"                          \
669         "shld   eax,edx,cl"             \
670         "pushf"                         \
671         "pop    [edi]"                          \
672         parm [edi] [eax] [edx] [cl]     \
673         value [eax]                     \
674         modify exact [eax edx cl];
675
676 u16             shrd_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
677 #pragma aux shrd_word_asm =                     \
678         "push   [edi]"                          \
679         "popf"                          \
680         "shrd   ax,dx,cl"               \
681         "pushf"                         \
682         "pop    [edi]"                          \
683         parm [edi] [ax] [dx] [cl]       \
684         value [ax]                      \
685         modify exact [ax dx cl];
686
687 u32     shrd_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
688 #pragma aux shrd_long_asm =                     \
689         "push   [edi]"                          \
690         "popf"                          \
691         "shrd   eax,edx,cl"             \
692         "pushf"                         \
693         "pop    [edi]"                          \
694         parm [edi] [eax] [edx] [cl]     \
695         value [eax]                     \
696         modify exact [eax edx cl];
697
698 u8      sbb_byte_asm(u32 *flags,u8 d, u8 s);
699 #pragma aux sbb_byte_asm =                      \
700         "push   [edi]"                          \
701         "popf"                          \
702         "sbb    al,bl"                  \
703         "pushf"                         \
704         "pop    [edi]"                          \
705         parm [edi] [al] [bl]            \
706         value [al]                      \
707         modify exact [al bl];
708
709 u16     sbb_word_asm(u32 *flags,u16 d, u16 s);
710 #pragma aux sbb_word_asm =                      \
711         "push   [edi]"                          \
712         "popf"                          \
713         "sbb    ax,bx"                  \
714         "pushf"                         \
715         "pop    [edi]"                          \
716         parm [edi] [ax] [bx]            \
717         value [ax]                      \
718         modify exact [ax bx];
719
720 u32     sbb_long_asm(u32 *flags,u32 d, u32 s);
721 #pragma aux sbb_long_asm =                      \
722         "push   [edi]"                          \
723         "popf"                          \
724         "sbb    eax,ebx"                \
725         "pushf"                         \
726         "pop    [edi]"                          \
727         parm [edi] [eax] [ebx]          \
728         value [eax]                     \
729         modify exact [eax ebx];
730
731 u8      sub_byte_asm(u32 *flags,u8 d, u8 s);
732 #pragma aux sub_byte_asm =                      \
733         "push   [edi]"                          \
734         "popf"                          \
735         "sub    al,bl"                  \
736         "pushf"                         \
737         "pop    [edi]"                          \
738         parm [edi] [al] [bl]            \
739         value [al]                      \
740         modify exact [al bl];
741
742 u16     sub_word_asm(u32 *flags,u16 d, u16 s);
743 #pragma aux sub_word_asm =                      \
744         "push   [edi]"                          \
745         "popf"                          \
746         "sub    ax,bx"                  \
747         "pushf"                         \
748         "pop    [edi]"                          \
749         parm [edi] [ax] [bx]            \
750         value [ax]                      \
751         modify exact [ax bx];
752
753 u32     sub_long_asm(u32 *flags,u32 d, u32 s);
754 #pragma aux sub_long_asm =                      \
755         "push   [edi]"                          \
756         "popf"                          \
757         "sub    eax,ebx"                \
758         "pushf"                         \
759         "pop    [edi]"                          \
760         parm [edi] [eax] [ebx]          \
761         value [eax]                     \
762         modify exact [eax ebx];
763
764 void    test_byte_asm(u32 *flags,u8 d, u8 s);
765 #pragma aux test_byte_asm =                     \
766         "push   [edi]"                          \
767         "popf"                          \
768         "test   al,bl"                  \
769         "pushf"                         \
770         "pop    [edi]"                          \
771         parm [edi] [al] [bl]            \
772         modify exact [al bl];
773
774 void    test_word_asm(u32 *flags,u16 d, u16 s);
775 #pragma aux test_word_asm =                     \
776         "push   [edi]"                          \
777         "popf"                          \
778         "test   ax,bx"                  \
779         "pushf"                         \
780         "pop    [edi]"                          \
781         parm [edi] [ax] [bx]            \
782         modify exact [ax bx];
783
784 void    test_long_asm(u32 *flags,u32 d, u32 s);
785 #pragma aux test_long_asm =                     \
786         "push   [edi]"                          \
787         "popf"                          \
788         "test   eax,ebx"                \
789         "pushf"                         \
790         "pop    [edi]"                          \
791         parm [edi] [eax] [ebx]          \
792         modify exact [eax ebx];
793
794 u8      xor_byte_asm(u32 *flags,u8 d, u8 s);
795 #pragma aux xor_byte_asm =                      \
796         "push   [edi]"                          \
797         "popf"                          \
798         "xor    al,bl"                  \
799         "pushf"                         \
800         "pop    [edi]"                          \
801         parm [edi] [al] [bl]            \
802         value [al]                      \
803         modify exact [al bl];
804
805 u16     xor_word_asm(u32 *flags,u16 d, u16 s);
806 #pragma aux xor_word_asm =                      \
807         "push   [edi]"                          \
808         "popf"                          \
809         "xor    ax,bx"                  \
810         "pushf"                         \
811         "pop    [edi]"                          \
812         parm [edi] [ax] [bx]            \
813         value [ax]                      \
814         modify exact [ax bx];
815
816 u32     xor_long_asm(u32 *flags,u32 d, u32 s);
817 #pragma aux xor_long_asm =                      \
818         "push   [edi]"                          \
819         "popf"                          \
820         "xor    eax,ebx"                \
821         "pushf"                         \
822         "pop    [edi]"                          \
823         parm [edi] [eax] [ebx]          \
824         value [eax]                     \
825         modify exact [eax ebx];
826
827 void    imul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
828 #pragma aux imul_byte_asm =                     \
829         "push   [edi]"                          \
830         "popf"                          \
831         "imul   bl"                     \
832         "pushf"                         \
833         "pop    [edi]"                          \
834         "mov    [esi],ax"                               \
835         parm [edi] [esi] [al] [bl]      \
836         modify exact [esi ax bl];
837
838 void    imul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
839 #pragma aux imul_word_asm =                     \
840         "push   [edi]"                          \
841         "popf"                          \
842         "imul   bx"                     \
843         "pushf"                         \
844         "pop    [edi]"                          \
845         "mov    [esi],ax"                               \
846         "mov    [ecx],dx"                               \
847         parm [edi] [esi] [ecx] [ax] [bx]\
848         modify exact [esi edi ax bx dx];
849
850 void    imul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
851 #pragma aux imul_long_asm =                     \
852         "push   [edi]"                          \
853         "popf"                          \
854         "imul   ebx"                    \
855         "pushf"                         \
856         "pop    [edi]"                          \
857         "mov    [esi],eax"                              \
858         "mov    [ecx],edx"                              \
859         parm [edi] [esi] [ecx] [eax] [ebx] \
860         modify exact [esi edi eax ebx edx];
861
862 void    mul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
863 #pragma aux mul_byte_asm =                      \
864         "push   [edi]"                          \
865         "popf"                          \
866         "mul    bl"                     \
867         "pushf"                         \
868         "pop    [edi]"                          \
869         "mov    [esi],ax"                               \
870         parm [edi] [esi] [al] [bl]      \
871         modify exact [esi ax bl];
872
873 void    mul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
874 #pragma aux mul_word_asm =                      \
875         "push   [edi]"                          \
876         "popf"                          \
877         "mul    bx"                     \
878         "pushf"                         \
879         "pop    [edi]"                          \
880         "mov    [esi],ax"                               \
881         "mov    [ecx],dx"                               \
882         parm [edi] [esi] [ecx] [ax] [bx]\
883         modify exact [esi edi ax bx dx];
884
885 void    mul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
886 #pragma aux mul_long_asm =                      \
887         "push   [edi]"                          \
888         "popf"                          \
889         "mul    ebx"                    \
890         "pushf"                         \
891         "pop    [edi]"                          \
892         "mov    [esi],eax"                              \
893         "mov    [ecx],edx"                              \
894         parm [edi] [esi] [ecx] [eax] [ebx] \
895         modify exact [esi edi eax ebx edx];
896
897 void    idiv_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
898 #pragma aux idiv_byte_asm =                     \
899         "push   [edi]"                          \
900         "popf"                          \
901         "idiv   bl"                     \
902         "pushf"                         \
903         "pop    [edi]"                          \
904         "mov    [esi],al"                               \
905         "mov    [ecx],ah"                               \
906         parm [edi] [esi] [ecx] [ax] [bl]\
907         modify exact [esi edi ax bl];
908
909 void    idiv_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
910 #pragma aux idiv_word_asm =                     \
911         "push   [edi]"                          \
912         "popf"                          \
913         "idiv   bx"                     \
914         "pushf"                         \
915         "pop    [edi]"                          \
916         "mov    [esi],ax"                               \
917         "mov    [ecx],dx"                               \
918         parm [edi] [esi] [ecx] [ax] [dx] [bx]\
919         modify exact [esi edi ax dx bx];
920
921 void    idiv_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
922 #pragma aux idiv_long_asm =                     \
923         "push   [edi]"                          \
924         "popf"                          \
925         "idiv   ebx"                    \
926         "pushf"                         \
927         "pop    [edi]"                          \
928         "mov    [esi],eax"                              \
929         "mov    [ecx],edx"                              \
930         parm [edi] [esi] [ecx] [eax] [edx] [ebx]\
931         modify exact [esi edi eax edx ebx];
932
933 void    div_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
934 #pragma aux div_byte_asm =                      \
935         "push   [edi]"                          \
936         "popf"                          \
937         "div    bl"                     \
938         "pushf"                         \
939         "pop    [edi]"                          \
940         "mov    [esi],al"                               \
941         "mov    [ecx],ah"                               \
942         parm [edi] [esi] [ecx] [ax] [bl]\
943         modify exact [esi edi ax bl];
944
945 void    div_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
946 #pragma aux div_word_asm =                      \
947         "push   [edi]"                          \
948         "popf"                          \
949         "div    bx"                     \
950         "pushf"                         \
951         "pop    [edi]"                          \
952         "mov    [esi],ax"                               \
953         "mov    [ecx],dx"                               \
954         parm [edi] [esi] [ecx] [ax] [dx] [bx]\
955         modify exact [esi edi ax dx bx];
956
957 void    div_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
958 #pragma aux div_long_asm =                      \
959         "push   [edi]"                          \
960         "popf"                          \
961         "div    ebx"                    \
962         "pushf"                         \
963         "pop    [edi]"                          \
964         "mov    [esi],eax"                              \
965         "mov    [ecx],edx"                              \
966         parm [edi] [esi] [ecx] [eax] [edx] [ebx]\
967         modify exact [esi edi eax edx ebx];
968
969 #endif
970
971 #endif /* __X86EMU_PRIM_ASM_H */