The Pedigree Project  0.1
prim_asm.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef __X86EMU_PRIM_ASM_H
21 #define __X86EMU_PRIM_ASM_H
22 
23 #ifdef __WATCOMC__
24 
25 #ifndef VALIDATE
26 #define __HAVE_INLINE_ASSEMBLER__
27 #endif
28 
29 u32 get_flags_asm(void);
30 #pragma aux get_flags_asm = "pushf" \
31  "pop eax" value[eax] modify exact[eax];
32 
33 u16 aaa_word_asm(u32 *flags, u16 d);
34 #pragma aux aaa_word_asm = \
35  "push [edi]" \
36  "popf" \
37  "aaa" \
38  "pushf" \
39  "pop [edi]" parm[edi][ax] value[ax] modify exact[ax];
40 
41 u16 aas_word_asm(u32 *flags, u16 d);
42 #pragma aux aas_word_asm = \
43  "push [edi]" \
44  "popf" \
45  "aas" \
46  "pushf" \
47  "pop [edi]" parm[edi][ax] value[ax] modify exact[ax];
48 
49 u16 aad_word_asm(u32 *flags, u16 d);
50 #pragma aux aad_word_asm = \
51  "push [edi]" \
52  "popf" \
53  "aad" \
54  "pushf" \
55  "pop [edi]" parm[edi][ax] value[ax] modify exact[ax];
56 
57 u16 aam_word_asm(u32 *flags, u8 d);
58 #pragma aux aam_word_asm = \
59  "push [edi]" \
60  "popf" \
61  "aam" \
62  "pushf" \
63  "pop [edi]" parm[edi][al] value[ax] modify exact[ax];
64 
65 u8 adc_byte_asm(u32 *flags, u8 d, u8 s);
66 #pragma aux adc_byte_asm = \
67  "push [edi]" \
68  "popf" \
69  "adc al,bl" \
70  "pushf" \
71  "pop [edi]" parm[edi][al][bl] value[al] modify exact[al bl];
72 
73 u16 adc_word_asm(u32 *flags, u16 d, u16 s);
74 #pragma aux adc_word_asm = \
75  "push [edi]" \
76  "popf" \
77  "adc ax,bx" \
78  "pushf" \
79  "pop [edi]" parm[edi][ax][bx] value[ax] modify exact[ax bx];
80 
81 u32 adc_long_asm(u32 *flags, u32 d, u32 s);
82 #pragma aux adc_long_asm = \
83  "push [edi]" \
84  "popf" \
85  "adc eax,ebx" \
86  "pushf" \
87  "pop [edi]" parm[edi][eax][ebx] value[eax] modify exact[eax ebx];
88 
89 u8 add_byte_asm(u32 *flags, u8 d, u8 s);
90 #pragma aux add_byte_asm = \
91  "push [edi]" \
92  "popf" \
93  "add al,bl" \
94  "pushf" \
95  "pop [edi]" parm[edi][al][bl] value[al] modify exact[al bl];
96 
97 u16 add_word_asm(u32 *flags, u16 d, u16 s);
98 #pragma aux add_word_asm = \
99  "push [edi]" \
100  "popf" \
101  "add ax,bx" \
102  "pushf" \
103  "pop [edi]" parm[edi][ax][bx] value[ax] modify exact[ax bx];
104 
105 u32 add_long_asm(u32 *flags, u32 d, u32 s);
106 #pragma aux add_long_asm = \
107  "push [edi]" \
108  "popf" \
109  "add eax,ebx" \
110  "pushf" \
111  "pop [edi]" parm[edi][eax][ebx] value[eax] modify exact[eax ebx];
112 
113 u8 and_byte_asm(u32 *flags, u8 d, u8 s);
114 #pragma aux and_byte_asm = \
115  "push [edi]" \
116  "popf" \
117  "and al,bl" \
118  "pushf" \
119  "pop [edi]" parm[edi][al][bl] value[al] modify exact[al bl];
120 
121 u16 and_word_asm(u32 *flags, u16 d, u16 s);
122 #pragma aux and_word_asm = \
123  "push [edi]" \
124  "popf" \
125  "and ax,bx" \
126  "pushf" \
127  "pop [edi]" parm[edi][ax][bx] value[ax] modify exact[ax bx];
128 
129 u32 and_long_asm(u32 *flags, u32 d, u32 s);
130 #pragma aux and_long_asm = \
131  "push [edi]" \
132  "popf" \
133  "and eax,ebx" \
134  "pushf" \
135  "pop [edi]" parm[edi][eax][ebx] value[eax] modify exact[eax ebx];
136 
137 u8 cmp_byte_asm(u32 *flags, u8 d, u8 s);
138 #pragma aux cmp_byte_asm = \
139  "push [edi]" \
140  "popf" \
141  "cmp al,bl" \
142  "pushf" \
143  "pop [edi]" parm[edi][al][bl] value[al] modify exact[al bl];
144 
145 u16 cmp_word_asm(u32 *flags, u16 d, u16 s);
146 #pragma aux cmp_word_asm = \
147  "push [edi]" \
148  "popf" \
149  "cmp ax,bx" \
150  "pushf" \
151  "pop [edi]" parm[edi][ax][bx] value[ax] modify exact[ax bx];
152 
153 u32 cmp_long_asm(u32 *flags, u32 d, u32 s);
154 #pragma aux cmp_long_asm = \
155  "push [edi]" \
156  "popf" \
157  "cmp eax,ebx" \
158  "pushf" \
159  "pop [edi]" parm[edi][eax][ebx] value[eax] modify exact[eax ebx];
160 
161 u8 daa_byte_asm(u32 *flags, u8 d);
162 #pragma aux daa_byte_asm = \
163  "push [edi]" \
164  "popf" \
165  "daa" \
166  "pushf" \
167  "pop [edi]" parm[edi][al] value[al] modify exact[al];
168 
169 u8 das_byte_asm(u32 *flags, u8 d);
170 #pragma aux das_byte_asm = \
171  "push [edi]" \
172  "popf" \
173  "das" \
174  "pushf" \
175  "pop [edi]" parm[edi][al] value[al] modify exact[al];
176 
177 u8 dec_byte_asm(u32 *flags, u8 d);
178 #pragma aux dec_byte_asm = \
179  "push [edi]" \
180  "popf" \
181  "dec al" \
182  "pushf" \
183  "pop [edi]" parm[edi][al] value[al] modify exact[al];
184 
185 u16 dec_word_asm(u32 *flags, u16 d);
186 #pragma aux dec_word_asm = \
187  "push [edi]" \
188  "popf" \
189  "dec ax" \
190  "pushf" \
191  "pop [edi]" parm[edi][ax] value[ax] modify exact[ax];
192 
193 u32 dec_long_asm(u32 *flags, u32 d);
194 #pragma aux dec_long_asm = \
195  "push [edi]" \
196  "popf" \
197  "dec eax" \
198  "pushf" \
199  "pop [edi]" parm[edi][eax] value[eax] modify exact[eax];
200 
201 u8 inc_byte_asm(u32 *flags, u8 d);
202 #pragma aux inc_byte_asm = \
203  "push [edi]" \
204  "popf" \
205  "inc al" \
206  "pushf" \
207  "pop [edi]" parm[edi][al] value[al] modify exact[al];
208 
209 u16 inc_word_asm(u32 *flags, u16 d);
210 #pragma aux inc_word_asm = \
211  "push [edi]" \
212  "popf" \
213  "inc ax" \
214  "pushf" \
215  "pop [edi]" parm[edi][ax] value[ax] modify exact[ax];
216 
217 u32 inc_long_asm(u32 *flags, u32 d);
218 #pragma aux inc_long_asm = \
219  "push [edi]" \
220  "popf" \
221  "inc eax" \
222  "pushf" \
223  "pop [edi]" parm[edi][eax] value[eax] modify exact[eax];
224 
225 u8 or_byte_asm(u32 *flags, u8 d, u8 s);
226 #pragma aux or_byte_asm = \
227  "push [edi]" \
228  "popf" \
229  "or al,bl" \
230  "pushf" \
231  "pop [edi]" parm[edi][al][bl] value[al] modify exact[al bl];
232 
233 u16 or_word_asm(u32 *flags, u16 d, u16 s);
234 #pragma aux or_word_asm = \
235  "push [edi]" \
236  "popf" \
237  "or ax,bx" \
238  "pushf" \
239  "pop [edi]" parm[edi][ax][bx] value[ax] modify exact[ax bx];
240 
241 u32 or_long_asm(u32 *flags, u32 d, u32 s);
242 #pragma aux or_long_asm = \
243  "push [edi]" \
244  "popf" \
245  "or eax,ebx" \
246  "pushf" \
247  "pop [edi]" parm[edi][eax][ebx] value[eax] modify exact[eax ebx];
248 
249 u8 neg_byte_asm(u32 *flags, u8 d);
250 #pragma aux neg_byte_asm = \
251  "push [edi]" \
252  "popf" \
253  "neg al" \
254  "pushf" \
255  "pop [edi]" parm[edi][al] value[al] modify exact[al];
256 
257 u16 neg_word_asm(u32 *flags, u16 d);
258 #pragma aux neg_word_asm = \
259  "push [edi]" \
260  "popf" \
261  "neg ax" \
262  "pushf" \
263  "pop [edi]" parm[edi][ax] value[ax] modify exact[ax];
264 
265 u32 neg_long_asm(u32 *flags, u32 d);
266 #pragma aux neg_long_asm = \
267  "push [edi]" \
268  "popf" \
269  "neg eax" \
270  "pushf" \
271  "pop [edi]" parm[edi][eax] value[eax] modify exact[eax];
272 
273 u8 not_byte_asm(u32 *flags, u8 d);
274 #pragma aux not_byte_asm = \
275  "push [edi]" \
276  "popf" \
277  "not al" \
278  "pushf" \
279  "pop [edi]" parm[edi][al] value[al] modify exact[al];
280 
281 u16 not_word_asm(u32 *flags, u16 d);
282 #pragma aux not_word_asm = \
283  "push [edi]" \
284  "popf" \
285  "not ax" \
286  "pushf" \
287  "pop [edi]" parm[edi][ax] value[ax] modify exact[ax];
288 
289 u32 not_long_asm(u32 *flags, u32 d);
290 #pragma aux not_long_asm = \
291  "push [edi]" \
292  "popf" \
293  "not eax" \
294  "pushf" \
295  "pop [edi]" parm[edi][eax] value[eax] modify exact[eax];
296 
297 u8 rcl_byte_asm(u32 *flags, u8 d, u8 s);
298 #pragma aux rcl_byte_asm = \
299  "push [edi]" \
300  "popf" \
301  "rcl al,cl" \
302  "pushf" \
303  "pop [edi]" parm[edi][al][cl] value[al] modify exact[al cl];
304 
305 u16 rcl_word_asm(u32 *flags, u16 d, u8 s);
306 #pragma aux rcl_word_asm = \
307  "push [edi]" \
308  "popf" \
309  "rcl ax,cl" \
310  "pushf" \
311  "pop [edi]" parm[edi][ax][cl] value[ax] modify exact[ax cl];
312 
313 u32 rcl_long_asm(u32 *flags, u32 d, u8 s);
314 #pragma aux rcl_long_asm = \
315  "push [edi]" \
316  "popf" \
317  "rcl eax,cl" \
318  "pushf" \
319  "pop [edi]" parm[edi][eax][cl] value[eax] modify exact[eax cl];
320 
321 u8 rcr_byte_asm(u32 *flags, u8 d, u8 s);
322 #pragma aux rcr_byte_asm = \
323  "push [edi]" \
324  "popf" \
325  "rcr al,cl" \
326  "pushf" \
327  "pop [edi]" parm[edi][al][cl] value[al] modify exact[al cl];
328 
329 u16 rcr_word_asm(u32 *flags, u16 d, u8 s);
330 #pragma aux rcr_word_asm = \
331  "push [edi]" \
332  "popf" \
333  "rcr ax,cl" \
334  "pushf" \
335  "pop [edi]" parm[edi][ax][cl] value[ax] modify exact[ax cl];
336 
337 u32 rcr_long_asm(u32 *flags, u32 d, u8 s);
338 #pragma aux rcr_long_asm = \
339  "push [edi]" \
340  "popf" \
341  "rcr eax,cl" \
342  "pushf" \
343  "pop [edi]" parm[edi][eax][cl] value[eax] modify exact[eax cl];
344 
345 u8 rol_byte_asm(u32 *flags, u8 d, u8 s);
346 #pragma aux rol_byte_asm = \
347  "push [edi]" \
348  "popf" \
349  "rol al,cl" \
350  "pushf" \
351  "pop [edi]" parm[edi][al][cl] value[al] modify exact[al cl];
352 
353 u16 rol_word_asm(u32 *flags, u16 d, u8 s);
354 #pragma aux rol_word_asm = \
355  "push [edi]" \
356  "popf" \
357  "rol ax,cl" \
358  "pushf" \
359  "pop [edi]" parm[edi][ax][cl] value[ax] modify exact[ax cl];
360 
361 u32 rol_long_asm(u32 *flags, u32 d, u8 s);
362 #pragma aux rol_long_asm = \
363  "push [edi]" \
364  "popf" \
365  "rol eax,cl" \
366  "pushf" \
367  "pop [edi]" parm[edi][eax][cl] value[eax] modify exact[eax cl];
368 
369 u8 ror_byte_asm(u32 *flags, u8 d, u8 s);
370 #pragma aux ror_byte_asm = \
371  "push [edi]" \
372  "popf" \
373  "ror al,cl" \
374  "pushf" \
375  "pop [edi]" parm[edi][al][cl] value[al] modify exact[al cl];
376 
377 u16 ror_word_asm(u32 *flags, u16 d, u8 s);
378 #pragma aux ror_word_asm = \
379  "push [edi]" \
380  "popf" \
381  "ror ax,cl" \
382  "pushf" \
383  "pop [edi]" parm[edi][ax][cl] value[ax] modify exact[ax cl];
384 
385 u32 ror_long_asm(u32 *flags, u32 d, u8 s);
386 #pragma aux ror_long_asm = \
387  "push [edi]" \
388  "popf" \
389  "ror eax,cl" \
390  "pushf" \
391  "pop [edi]" parm[edi][eax][cl] value[eax] modify exact[eax cl];
392 
393 u8 shl_byte_asm(u32 *flags, u8 d, u8 s);
394 #pragma aux shl_byte_asm = \
395  "push [edi]" \
396  "popf" \
397  "shl al,cl" \
398  "pushf" \
399  "pop [edi]" parm[edi][al][cl] value[al] modify exact[al cl];
400 
401 u16 shl_word_asm(u32 *flags, u16 d, u8 s);
402 #pragma aux shl_word_asm = \
403  "push [edi]" \
404  "popf" \
405  "shl ax,cl" \
406  "pushf" \
407  "pop [edi]" parm[edi][ax][cl] value[ax] modify exact[ax cl];
408 
409 u32 shl_long_asm(u32 *flags, u32 d, u8 s);
410 #pragma aux shl_long_asm = \
411  "push [edi]" \
412  "popf" \
413  "shl eax,cl" \
414  "pushf" \
415  "pop [edi]" parm[edi][eax][cl] value[eax] modify exact[eax cl];
416 
417 u8 shr_byte_asm(u32 *flags, u8 d, u8 s);
418 #pragma aux shr_byte_asm = \
419  "push [edi]" \
420  "popf" \
421  "shr al,cl" \
422  "pushf" \
423  "pop [edi]" parm[edi][al][cl] value[al] modify exact[al cl];
424 
425 u16 shr_word_asm(u32 *flags, u16 d, u8 s);
426 #pragma aux shr_word_asm = \
427  "push [edi]" \
428  "popf" \
429  "shr ax,cl" \
430  "pushf" \
431  "pop [edi]" parm[edi][ax][cl] value[ax] modify exact[ax cl];
432 
433 u32 shr_long_asm(u32 *flags, u32 d, u8 s);
434 #pragma aux shr_long_asm = \
435  "push [edi]" \
436  "popf" \
437  "shr eax,cl" \
438  "pushf" \
439  "pop [edi]" parm[edi][eax][cl] value[eax] modify exact[eax cl];
440 
441 u8 sar_byte_asm(u32 *flags, u8 d, u8 s);
442 #pragma aux sar_byte_asm = \
443  "push [edi]" \
444  "popf" \
445  "sar al,cl" \
446  "pushf" \
447  "pop [edi]" parm[edi][al][cl] value[al] modify exact[al cl];
448 
449 u16 sar_word_asm(u32 *flags, u16 d, u8 s);
450 #pragma aux sar_word_asm = \
451  "push [edi]" \
452  "popf" \
453  "sar ax,cl" \
454  "pushf" \
455  "pop [edi]" parm[edi][ax][cl] value[ax] modify exact[ax cl];
456 
457 u32 sar_long_asm(u32 *flags, u32 d, u8 s);
458 #pragma aux sar_long_asm = \
459  "push [edi]" \
460  "popf" \
461  "sar eax,cl" \
462  "pushf" \
463  "pop [edi]" parm[edi][eax][cl] value[eax] modify exact[eax cl];
464 
465 u16 shld_word_asm(u32 *flags, u16 d, u16 fill, u8 s);
466 #pragma aux shld_word_asm = \
467  "push [edi]" \
468  "popf" \
469  "shld ax,dx,cl" \
470  "pushf" \
471  "pop [edi]" parm[edi][ax][dx][cl] value[ax] modify exact[ax dx cl];
472 
473 u32 shld_long_asm(u32 *flags, u32 d, u32 fill, u8 s);
474 #pragma aux shld_long_asm = "push [edi]" \
475  "popf" \
476  "shld eax,edx,cl" \
477  "pushf" \
478  "pop [edi]" parm[edi][eax][edx] \
479  [cl] value[eax] modify exact[eax edx cl];
480 
481 u16 shrd_word_asm(u32 *flags, u16 d, u16 fill, u8 s);
482 #pragma aux shrd_word_asm = \
483  "push [edi]" \
484  "popf" \
485  "shrd ax,dx,cl" \
486  "pushf" \
487  "pop [edi]" parm[edi][ax][dx][cl] value[ax] modify exact[ax dx cl];
488 
489 u32 shrd_long_asm(u32 *flags, u32 d, u32 fill, u8 s);
490 #pragma aux shrd_long_asm = "push [edi]" \
491  "popf" \
492  "shrd eax,edx,cl" \
493  "pushf" \
494  "pop [edi]" parm[edi][eax][edx] \
495  [cl] value[eax] modify exact[eax edx cl];
496 
497 u8 sbb_byte_asm(u32 *flags, u8 d, u8 s);
498 #pragma aux sbb_byte_asm = \
499  "push [edi]" \
500  "popf" \
501  "sbb al,bl" \
502  "pushf" \
503  "pop [edi]" parm[edi][al][bl] value[al] modify exact[al bl];
504 
505 u16 sbb_word_asm(u32 *flags, u16 d, u16 s);
506 #pragma aux sbb_word_asm = \
507  "push [edi]" \
508  "popf" \
509  "sbb ax,bx" \
510  "pushf" \
511  "pop [edi]" parm[edi][ax][bx] value[ax] modify exact[ax bx];
512 
513 u32 sbb_long_asm(u32 *flags, u32 d, u32 s);
514 #pragma aux sbb_long_asm = \
515  "push [edi]" \
516  "popf" \
517  "sbb eax,ebx" \
518  "pushf" \
519  "pop [edi]" parm[edi][eax][ebx] value[eax] modify exact[eax ebx];
520 
521 u8 sub_byte_asm(u32 *flags, u8 d, u8 s);
522 #pragma aux sub_byte_asm = \
523  "push [edi]" \
524  "popf" \
525  "sub al,bl" \
526  "pushf" \
527  "pop [edi]" parm[edi][al][bl] value[al] modify exact[al bl];
528 
529 u16 sub_word_asm(u32 *flags, u16 d, u16 s);
530 #pragma aux sub_word_asm = \
531  "push [edi]" \
532  "popf" \
533  "sub ax,bx" \
534  "pushf" \
535  "pop [edi]" parm[edi][ax][bx] value[ax] modify exact[ax bx];
536 
537 u32 sub_long_asm(u32 *flags, u32 d, u32 s);
538 #pragma aux sub_long_asm = \
539  "push [edi]" \
540  "popf" \
541  "sub eax,ebx" \
542  "pushf" \
543  "pop [edi]" parm[edi][eax][ebx] value[eax] modify exact[eax ebx];
544 
545 void test_byte_asm(u32 *flags, u8 d, u8 s);
546 #pragma aux test_byte_asm = \
547  "push [edi]" \
548  "popf" \
549  "test al,bl" \
550  "pushf" \
551  "pop [edi]" parm[edi][al][bl] modify exact[al bl];
552 
553 void test_word_asm(u32 *flags, u16 d, u16 s);
554 #pragma aux test_word_asm = \
555  "push [edi]" \
556  "popf" \
557  "test ax,bx" \
558  "pushf" \
559  "pop [edi]" parm[edi][ax][bx] modify exact[ax bx];
560 
561 void test_long_asm(u32 *flags, u32 d, u32 s);
562 #pragma aux test_long_asm = \
563  "push [edi]" \
564  "popf" \
565  "test eax,ebx" \
566  "pushf" \
567  "pop [edi]" parm[edi][eax][ebx] modify exact[eax ebx];
568 
569 u8 xor_byte_asm(u32 *flags, u8 d, u8 s);
570 #pragma aux xor_byte_asm = \
571  "push [edi]" \
572  "popf" \
573  "xor al,bl" \
574  "pushf" \
575  "pop [edi]" parm[edi][al][bl] value[al] modify exact[al bl];
576 
577 u16 xor_word_asm(u32 *flags, u16 d, u16 s);
578 #pragma aux xor_word_asm = \
579  "push [edi]" \
580  "popf" \
581  "xor ax,bx" \
582  "pushf" \
583  "pop [edi]" parm[edi][ax][bx] value[ax] modify exact[ax bx];
584 
585 u32 xor_long_asm(u32 *flags, u32 d, u32 s);
586 #pragma aux xor_long_asm = \
587  "push [edi]" \
588  "popf" \
589  "xor eax,ebx" \
590  "pushf" \
591  "pop [edi]" parm[edi][eax][ebx] value[eax] modify exact[eax ebx];
592 
593 void imul_byte_asm(u32 *flags, u16 *ax, u8 d, u8 s);
594 #pragma aux imul_byte_asm = \
595  "push [edi]" \
596  "popf" \
597  "imul bl" \
598  "pushf" \
599  "pop [edi]" \
600  "mov [esi],ax" parm[edi][esi][al][bl] modify exact[esi ax bl];
601 
602 void imul_word_asm(u32 *flags, u16 *ax, u16 *dx, u16 d, u16 s);
603 #pragma aux imul_word_asm = \
604  "push [edi]" \
605  "popf" \
606  "imul bx" \
607  "pushf" \
608  "pop [edi]" \
609  "mov [esi],ax" \
610  "mov [ecx],dx" parm[edi][esi][ecx][ax][bx] modify exact[esi edi ax \
611  bx dx];
612 
613 void imul_long_asm(u32 *flags, u32 *eax, u32 *edx, u32 d, u32 s);
614 #pragma aux imul_long_asm = "push [edi]" \
615  "popf" \
616  "imul ebx" \
617  "pushf" \
618  "pop [edi]" \
619  "mov [esi],eax" \
620  "mov [ecx],edx" parm[edi][esi][ecx][eax] \
621  [ebx] modify exact[esi edi eax ebx edx];
622 
623 void mul_byte_asm(u32 *flags, u16 *ax, u8 d, u8 s);
624 #pragma aux mul_byte_asm = \
625  "push [edi]" \
626  "popf" \
627  "mul bl" \
628  "pushf" \
629  "pop [edi]" \
630  "mov [esi],ax" parm[edi][esi][al][bl] modify exact[esi ax bl];
631 
632 void mul_word_asm(u32 *flags, u16 *ax, u16 *dx, u16 d, u16 s);
633 #pragma aux mul_word_asm = \
634  "push [edi]" \
635  "popf" \
636  "mul bx" \
637  "pushf" \
638  "pop [edi]" \
639  "mov [esi],ax" \
640  "mov [ecx],dx" parm[edi][esi][ecx][ax][bx] modify exact[esi edi ax \
641  bx dx];
642 
643 void mul_long_asm(u32 *flags, u32 *eax, u32 *edx, u32 d, u32 s);
644 #pragma aux mul_long_asm = \
645  "push [edi]" \
646  "popf" \
647  "mul ebx" \
648  "pushf" \
649  "pop [edi]" \
650  "mov [esi],eax" \
651  "mov [ecx],edx" parm[edi][esi][ecx][eax][ebx] modify exact[esi edi eax ebx \
652  edx];
653 
654 void idiv_byte_asm(u32 *flags, u8 *al, u8 *ah, u16 d, u8 s);
655 #pragma aux idiv_byte_asm = \
656  "push [edi]" \
657  "popf" \
658  "idiv bl" \
659  "pushf" \
660  "pop [edi]" \
661  "mov [esi],al" \
662  "mov [ecx],ah" parm[edi][esi][ecx][ax][bl] modify exact[esi edi ax \
663  bl];
664 
665 void idiv_word_asm(u32 *flags, u16 *ax, u16 *dx, u16 dlo, u16 dhi, u16 s);
666 #pragma aux idiv_word_asm = "push [edi]" \
667  "popf" \
668  "idiv bx" \
669  "pushf" \
670  "pop [edi]" \
671  "mov [esi],ax" \
672  "mov [ecx],dx" parm[edi][esi][ecx][ax][dx] \
673  [bx] modify exact[esi edi ax dx bx];
674 
675 void idiv_long_asm(u32 *flags, u32 *eax, u32 *edx, u32 dlo, u32 dhi, u32 s);
676 #pragma aux idiv_long_asm = "push [edi]" \
677  "popf" \
678  "idiv ebx" \
679  "pushf" \
680  "pop [edi]" \
681  "mov [esi],eax" \
682  "mov [ecx],edx" parm[edi][esi][ecx][eax] \
683  [edx][ebx] modify exact[esi edi eax edx ebx];
684 
685 void div_byte_asm(u32 *flags, u8 *al, u8 *ah, u16 d, u8 s);
686 #pragma aux div_byte_asm = \
687  "push [edi]" \
688  "popf" \
689  "div bl" \
690  "pushf" \
691  "pop [edi]" \
692  "mov [esi],al" \
693  "mov [ecx],ah" parm[edi][esi][ecx][ax][bl] modify exact[esi edi ax \
694  bl];
695 
696 void div_word_asm(u32 *flags, u16 *ax, u16 *dx, u16 dlo, u16 dhi, u16 s);
697 #pragma aux div_word_asm = "push [edi]" \
698  "popf" \
699  "div bx" \
700  "pushf" \
701  "pop [edi]" \
702  "mov [esi],ax" \
703  "mov [ecx],dx" parm[edi][esi][ecx][ax][dx] \
704  [bx] modify exact[esi edi ax dx bx];
705 
706 void div_long_asm(u32 *flags, u32 *eax, u32 *edx, u32 dlo, u32 dhi, u32 s);
707 #pragma aux div_long_asm = "push [edi]" \
708  "popf" \
709  "div ebx" \
710  "pushf" \
711  "pop [edi]" \
712  "mov [esi],eax" \
713  "mov [ecx],edx" parm[edi][esi][ecx][eax][edx] \
714  [ebx] modify exact[esi edi eax edx ebx];
715 
716 #endif
717 
718 #endif /* __X86EMU_PRIM_ASM_H */