1 /****************************************************************************
3 * Realmode X86 Emulator Library
5 * Copyright (C) 1996-1999 SciTech Software, Inc.
6 * Copyright (C) David Mosberger-Tang
7 * Copyright (C) 1999 Egbert Eich
9 * ========================================================================
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.
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.
29 * ========================================================================
31 * Language: Watcom C++ 10.6 or later
33 * Developer: Kendall Bennett
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
41 ****************************************************************************/
43 #ifndef __X86EMU_PRIM_ASM_H
44 #define __X86EMU_PRIM_ASM_H
49 #define __HAVE_INLINE_ASSEMBLER__
52 u32
get_flags_asm(void);
53 #pragma aux get_flags_asm = \
59 u16
aaa_word_asm(u32
*flags
,u16 d
);
60 #pragma aux aaa_word_asm = \
70 u16
aas_word_asm(u32
*flags
,u16 d
);
71 #pragma aux aas_word_asm = \
81 u16
aad_word_asm(u32
*flags
,u16 d
);
82 #pragma aux aad_word_asm = \
92 u16
aam_word_asm(u32
*flags
,u8 d
);
93 #pragma aux aam_word_asm = \
103 u8
adc_byte_asm(u32
*flags
,u8 d
, u8 s
);
104 #pragma aux adc_byte_asm = \
110 parm [edi] [al] [bl] \
112 modify exact [al bl];
114 u16
adc_word_asm(u32
*flags
,u16 d
, u16 s
);
115 #pragma aux adc_word_asm = \
121 parm [edi] [ax] [bx] \
123 modify exact [ax bx];
125 u32
adc_long_asm(u32
*flags
,u32 d
, u32 s
);
126 #pragma aux adc_long_asm = \
132 parm [edi] [eax] [ebx] \
134 modify exact [eax ebx];
136 u8
add_byte_asm(u32
*flags
,u8 d
, u8 s
);
137 #pragma aux add_byte_asm = \
143 parm [edi] [al] [bl] \
145 modify exact [al bl];
147 u16
add_word_asm(u32
*flags
,u16 d
, u16 s
);
148 #pragma aux add_word_asm = \
154 parm [edi] [ax] [bx] \
156 modify exact [ax bx];
158 u32
add_long_asm(u32
*flags
,u32 d
, u32 s
);
159 #pragma aux add_long_asm = \
165 parm [edi] [eax] [ebx] \
167 modify exact [eax ebx];
169 u8
and_byte_asm(u32
*flags
,u8 d
, u8 s
);
170 #pragma aux and_byte_asm = \
176 parm [edi] [al] [bl] \
178 modify exact [al bl];
180 u16
and_word_asm(u32
*flags
,u16 d
, u16 s
);
181 #pragma aux and_word_asm = \
187 parm [edi] [ax] [bx] \
189 modify exact [ax bx];
191 u32
and_long_asm(u32
*flags
,u32 d
, u32 s
);
192 #pragma aux and_long_asm = \
198 parm [edi] [eax] [ebx] \
200 modify exact [eax ebx];
202 u8
cmp_byte_asm(u32
*flags
,u8 d
, u8 s
);
203 #pragma aux cmp_byte_asm = \
209 parm [edi] [al] [bl] \
211 modify exact [al bl];
213 u16
cmp_word_asm(u32
*flags
,u16 d
, u16 s
);
214 #pragma aux cmp_word_asm = \
220 parm [edi] [ax] [bx] \
222 modify exact [ax bx];
224 u32
cmp_long_asm(u32
*flags
,u32 d
, u32 s
);
225 #pragma aux cmp_long_asm = \
231 parm [edi] [eax] [ebx] \
233 modify exact [eax ebx];
235 u8
daa_byte_asm(u32
*flags
,u8 d
);
236 #pragma aux daa_byte_asm = \
246 u8
das_byte_asm(u32
*flags
,u8 d
);
247 #pragma aux das_byte_asm = \
257 u8
dec_byte_asm(u32
*flags
,u8 d
);
258 #pragma aux dec_byte_asm = \
268 u16
dec_word_asm(u32
*flags
,u16 d
);
269 #pragma aux dec_word_asm = \
279 u32
dec_long_asm(u32
*flags
,u32 d
);
280 #pragma aux dec_long_asm = \
290 u8
inc_byte_asm(u32
*flags
,u8 d
);
291 #pragma aux inc_byte_asm = \
301 u16
inc_word_asm(u32
*flags
,u16 d
);
302 #pragma aux inc_word_asm = \
312 u32
inc_long_asm(u32
*flags
,u32 d
);
313 #pragma aux inc_long_asm = \
323 u8
or_byte_asm(u32
*flags
,u8 d
, u8 s
);
324 #pragma aux or_byte_asm = \
330 parm [edi] [al] [bl] \
332 modify exact [al bl];
334 u16
or_word_asm(u32
*flags
,u16 d
, u16 s
);
335 #pragma aux or_word_asm = \
341 parm [edi] [ax] [bx] \
343 modify exact [ax bx];
345 u32
or_long_asm(u32
*flags
,u32 d
, u32 s
);
346 #pragma aux or_long_asm = \
352 parm [edi] [eax] [ebx] \
354 modify exact [eax ebx];
356 u8
neg_byte_asm(u32
*flags
,u8 d
);
357 #pragma aux neg_byte_asm = \
367 u16
neg_word_asm(u32
*flags
,u16 d
);
368 #pragma aux neg_word_asm = \
378 u32
neg_long_asm(u32
*flags
,u32 d
);
379 #pragma aux neg_long_asm = \
389 u8
not_byte_asm(u32
*flags
,u8 d
);
390 #pragma aux not_byte_asm = \
400 u16
not_word_asm(u32
*flags
,u16 d
);
401 #pragma aux not_word_asm = \
411 u32
not_long_asm(u32
*flags
,u32 d
);
412 #pragma aux not_long_asm = \
422 u8
rcl_byte_asm(u32
*flags
,u8 d
, u8 s
);
423 #pragma aux rcl_byte_asm = \
429 parm [edi] [al] [cl] \
431 modify exact [al cl];
433 u16
rcl_word_asm(u32
*flags
,u16 d
, u8 s
);
434 #pragma aux rcl_word_asm = \
440 parm [edi] [ax] [cl] \
442 modify exact [ax cl];
444 u32
rcl_long_asm(u32
*flags
,u32 d
, u8 s
);
445 #pragma aux rcl_long_asm = \
451 parm [edi] [eax] [cl] \
453 modify exact [eax cl];
455 u8
rcr_byte_asm(u32
*flags
,u8 d
, u8 s
);
456 #pragma aux rcr_byte_asm = \
462 parm [edi] [al] [cl] \
464 modify exact [al cl];
466 u16
rcr_word_asm(u32
*flags
,u16 d
, u8 s
);
467 #pragma aux rcr_word_asm = \
473 parm [edi] [ax] [cl] \
475 modify exact [ax cl];
477 u32
rcr_long_asm(u32
*flags
,u32 d
, u8 s
);
478 #pragma aux rcr_long_asm = \
484 parm [edi] [eax] [cl] \
486 modify exact [eax cl];
488 u8
rol_byte_asm(u32
*flags
,u8 d
, u8 s
);
489 #pragma aux rol_byte_asm = \
495 parm [edi] [al] [cl] \
497 modify exact [al cl];
499 u16
rol_word_asm(u32
*flags
,u16 d
, u8 s
);
500 #pragma aux rol_word_asm = \
506 parm [edi] [ax] [cl] \
508 modify exact [ax cl];
510 u32
rol_long_asm(u32
*flags
,u32 d
, u8 s
);
511 #pragma aux rol_long_asm = \
517 parm [edi] [eax] [cl] \
519 modify exact [eax cl];
521 u8
ror_byte_asm(u32
*flags
,u8 d
, u8 s
);
522 #pragma aux ror_byte_asm = \
528 parm [edi] [al] [cl] \
530 modify exact [al cl];
532 u16
ror_word_asm(u32
*flags
,u16 d
, u8 s
);
533 #pragma aux ror_word_asm = \
539 parm [edi] [ax] [cl] \
541 modify exact [ax cl];
543 u32
ror_long_asm(u32
*flags
,u32 d
, u8 s
);
544 #pragma aux ror_long_asm = \
550 parm [edi] [eax] [cl] \
552 modify exact [eax cl];
554 u8
shl_byte_asm(u32
*flags
,u8 d
, u8 s
);
555 #pragma aux shl_byte_asm = \
561 parm [edi] [al] [cl] \
563 modify exact [al cl];
565 u16
shl_word_asm(u32
*flags
,u16 d
, u8 s
);
566 #pragma aux shl_word_asm = \
572 parm [edi] [ax] [cl] \
574 modify exact [ax cl];
576 u32
shl_long_asm(u32
*flags
,u32 d
, u8 s
);
577 #pragma aux shl_long_asm = \
583 parm [edi] [eax] [cl] \
585 modify exact [eax cl];
587 u8
shr_byte_asm(u32
*flags
,u8 d
, u8 s
);
588 #pragma aux shr_byte_asm = \
594 parm [edi] [al] [cl] \
596 modify exact [al cl];
598 u16
shr_word_asm(u32
*flags
,u16 d
, u8 s
);
599 #pragma aux shr_word_asm = \
605 parm [edi] [ax] [cl] \
607 modify exact [ax cl];
609 u32
shr_long_asm(u32
*flags
,u32 d
, u8 s
);
610 #pragma aux shr_long_asm = \
616 parm [edi] [eax] [cl] \
618 modify exact [eax cl];
620 u8
sar_byte_asm(u32
*flags
,u8 d
, u8 s
);
621 #pragma aux sar_byte_asm = \
627 parm [edi] [al] [cl] \
629 modify exact [al cl];
631 u16
sar_word_asm(u32
*flags
,u16 d
, u8 s
);
632 #pragma aux sar_word_asm = \
638 parm [edi] [ax] [cl] \
640 modify exact [ax cl];
642 u32
sar_long_asm(u32
*flags
,u32 d
, u8 s
);
643 #pragma aux sar_long_asm = \
649 parm [edi] [eax] [cl] \
651 modify exact [eax cl];
653 u16
shld_word_asm(u32
*flags
,u16 d
, u16 fill
, u8 s
);
654 #pragma aux shld_word_asm = \
660 parm [edi] [ax] [dx] [cl] \
662 modify exact [ax dx cl];
664 u32
shld_long_asm(u32
*flags
,u32 d
, u32 fill
, u8 s
);
665 #pragma aux shld_long_asm = \
671 parm [edi] [eax] [edx] [cl] \
673 modify exact [eax edx cl];
675 u16
shrd_word_asm(u32
*flags
,u16 d
, u16 fill
, u8 s
);
676 #pragma aux shrd_word_asm = \
682 parm [edi] [ax] [dx] [cl] \
684 modify exact [ax dx cl];
686 u32
shrd_long_asm(u32
*flags
,u32 d
, u32 fill
, u8 s
);
687 #pragma aux shrd_long_asm = \
693 parm [edi] [eax] [edx] [cl] \
695 modify exact [eax edx cl];
697 u8
sbb_byte_asm(u32
*flags
,u8 d
, u8 s
);
698 #pragma aux sbb_byte_asm = \
704 parm [edi] [al] [bl] \
706 modify exact [al bl];
708 u16
sbb_word_asm(u32
*flags
,u16 d
, u16 s
);
709 #pragma aux sbb_word_asm = \
715 parm [edi] [ax] [bx] \
717 modify exact [ax bx];
719 u32
sbb_long_asm(u32
*flags
,u32 d
, u32 s
);
720 #pragma aux sbb_long_asm = \
726 parm [edi] [eax] [ebx] \
728 modify exact [eax ebx];
730 u8
sub_byte_asm(u32
*flags
,u8 d
, u8 s
);
731 #pragma aux sub_byte_asm = \
737 parm [edi] [al] [bl] \
739 modify exact [al bl];
741 u16
sub_word_asm(u32
*flags
,u16 d
, u16 s
);
742 #pragma aux sub_word_asm = \
748 parm [edi] [ax] [bx] \
750 modify exact [ax bx];
752 u32
sub_long_asm(u32
*flags
,u32 d
, u32 s
);
753 #pragma aux sub_long_asm = \
759 parm [edi] [eax] [ebx] \
761 modify exact [eax ebx];
763 void test_byte_asm(u32
*flags
,u8 d
, u8 s
);
764 #pragma aux test_byte_asm = \
770 parm [edi] [al] [bl] \
771 modify exact [al bl];
773 void test_word_asm(u32
*flags
,u16 d
, u16 s
);
774 #pragma aux test_word_asm = \
780 parm [edi] [ax] [bx] \
781 modify exact [ax bx];
783 void test_long_asm(u32
*flags
,u32 d
, u32 s
);
784 #pragma aux test_long_asm = \
790 parm [edi] [eax] [ebx] \
791 modify exact [eax ebx];
793 u8
xor_byte_asm(u32
*flags
,u8 d
, u8 s
);
794 #pragma aux xor_byte_asm = \
800 parm [edi] [al] [bl] \
802 modify exact [al bl];
804 u16
xor_word_asm(u32
*flags
,u16 d
, u16 s
);
805 #pragma aux xor_word_asm = \
811 parm [edi] [ax] [bx] \
813 modify exact [ax bx];
815 u32
xor_long_asm(u32
*flags
,u32 d
, u32 s
);
816 #pragma aux xor_long_asm = \
822 parm [edi] [eax] [ebx] \
824 modify exact [eax ebx];
826 void imul_byte_asm(u32
*flags
,u16
*ax
,u8 d
,u8 s
);
827 #pragma aux imul_byte_asm = \
834 parm [edi] [esi] [al] [bl] \
835 modify exact [esi ax bl];
837 void imul_word_asm(u32
*flags
,u16
*ax
,u16
*dx
,u16 d
,u16 s
);
838 #pragma aux imul_word_asm = \
846 parm [edi] [esi] [ecx] [ax] [bx]\
847 modify exact [esi edi ax bx dx];
849 void imul_long_asm(u32
*flags
,u32
*eax
,u32
*edx
,u32 d
,u32 s
);
850 #pragma aux imul_long_asm = \
858 parm [edi] [esi] [ecx] [eax] [ebx] \
859 modify exact [esi edi eax ebx edx];
861 void mul_byte_asm(u32
*flags
,u16
*ax
,u8 d
,u8 s
);
862 #pragma aux mul_byte_asm = \
869 parm [edi] [esi] [al] [bl] \
870 modify exact [esi ax bl];
872 void mul_word_asm(u32
*flags
,u16
*ax
,u16
*dx
,u16 d
,u16 s
);
873 #pragma aux mul_word_asm = \
881 parm [edi] [esi] [ecx] [ax] [bx]\
882 modify exact [esi edi ax bx dx];
884 void mul_long_asm(u32
*flags
,u32
*eax
,u32
*edx
,u32 d
,u32 s
);
885 #pragma aux mul_long_asm = \
893 parm [edi] [esi] [ecx] [eax] [ebx] \
894 modify exact [esi edi eax ebx edx];
896 void idiv_byte_asm(u32
*flags
,u8
*al
,u8
*ah
,u16 d
,u8 s
);
897 #pragma aux idiv_byte_asm = \
905 parm [edi] [esi] [ecx] [ax] [bl]\
906 modify exact [esi edi ax bl];
908 void idiv_word_asm(u32
*flags
,u16
*ax
,u16
*dx
,u16 dlo
,u16 dhi
,u16 s
);
909 #pragma aux idiv_word_asm = \
917 parm [edi] [esi] [ecx] [ax] [dx] [bx]\
918 modify exact [esi edi ax dx bx];
920 void idiv_long_asm(u32
*flags
,u32
*eax
,u32
*edx
,u32 dlo
,u32 dhi
,u32 s
);
921 #pragma aux idiv_long_asm = \
929 parm [edi] [esi] [ecx] [eax] [edx] [ebx]\
930 modify exact [esi edi eax edx ebx];
932 void div_byte_asm(u32
*flags
,u8
*al
,u8
*ah
,u16 d
,u8 s
);
933 #pragma aux div_byte_asm = \
941 parm [edi] [esi] [ecx] [ax] [bl]\
942 modify exact [esi edi ax bl];
944 void div_word_asm(u32
*flags
,u16
*ax
,u16
*dx
,u16 dlo
,u16 dhi
,u16 s
);
945 #pragma aux div_word_asm = \
953 parm [edi] [esi] [ecx] [ax] [dx] [bx]\
954 modify exact [esi edi ax dx bx];
956 void div_long_asm(u32
*flags
,u32
*eax
,u32
*edx
,u32 dlo
,u32 dhi
,u32 s
);
957 #pragma aux div_long_asm = \
965 parm [edi] [esi] [ecx] [eax] [edx] [ebx]\
966 modify exact [esi edi eax edx ebx];
970 #endif /* __X86EMU_PRIM_ASM_H */