Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

emu_prim_ops.h

Go to the documentation of this file.
00001 /**************************************************************************** 00002 * 00003 * Realmode X86 Emulator Library 00004 * 00005 * Copyright (C) 1996-1999 SciTech Software, Inc. 00006 * Copyright (C) David Mosberger-Tang 00007 * Copyright (C) 1999 Egbert Eich 00008 * 00009 * ======================================================================== 00010 * 00011 * Permission to use, copy, modify, distribute, and sell this software and 00012 * its documentation for any purpose is hereby granted without fee, 00013 * provided that the above copyright notice appear in all copies and that 00014 * both that copyright notice and this permission notice appear in 00015 * supporting documentation, and that the name of the authors not be used 00016 * in advertising or publicity pertaining to distribution of the software 00017 * without specific, written prior permission. The authors makes no 00018 * representations about the suitability of this software for any purpose. 00019 * It is provided "as is" without express or implied warranty. 00020 * 00021 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 00022 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 00023 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 00024 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 00025 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00026 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00027 * PERFORMANCE OF THIS SOFTWARE. 00028 * 00029 * ======================================================================== 00030 * 00031 * Language: ANSI C 00032 * Environment: Any 00033 * Developer: Kendall Bennett 00034 * 00035 * Description: Header file for primitive operation functions. 00036 * 00037 ****************************************************************************/ 00038 00039 #ifndef __X86EMU_PRIM_OPS_H 00040 #define __X86EMU_PRIM_OPS_H 00041 00042 u16 aaa_word (u16 d); 00043 u16 aas_word (u16 d); 00044 u16 aad_word (u16 d); 00045 u16 aam_word (u8 d); 00046 u8 adc_byte (u8 d, u8 s); 00047 u16 adc_word (u16 d, u16 s); 00048 u32 adc_long (u32 d, u32 s); 00049 u8 add_byte (u8 d, u8 s); 00050 u16 add_word (u16 d, u16 s); 00051 u32 add_long (u32 d, u32 s); 00052 u8 and_byte (u8 d, u8 s); 00053 u16 and_word (u16 d, u16 s); 00054 u32 and_long (u32 d, u32 s); 00055 u8 cmp_byte (u8 d, u8 s); 00056 u16 cmp_word (u16 d, u16 s); 00057 u32 cmp_long (u32 d, u32 s); 00058 u8 daa_byte (u8 d); 00059 u8 das_byte (u8 d); 00060 u8 dec_byte (u8 d); 00061 u16 dec_word (u16 d); 00062 u32 dec_long (u32 d); 00063 u8 inc_byte (u8 d); 00064 u16 inc_word (u16 d); 00065 u32 inc_long (u32 d); 00066 u8 or_byte (u8 d, u8 s); 00067 u16 or_word (u16 d, u16 s); 00068 u32 or_long (u32 d, u32 s); 00069 u8 neg_byte (u8 s); 00070 u16 neg_word (u16 s); 00071 u32 neg_long (u32 s); 00072 u8 not_byte (u8 s); 00073 u16 not_word (u16 s); 00074 u32 not_long (u32 s); 00075 u8 rcl_byte (u8 d, u8 s); 00076 u16 rcl_word (u16 d, u8 s); 00077 u32 rcl_long (u32 d, u8 s); 00078 u8 rcr_byte (u8 d, u8 s); 00079 u16 rcr_word (u16 d, u8 s); 00080 u32 rcr_long (u32 d, u8 s); 00081 u8 rol_byte (u8 d, u8 s); 00082 u16 rol_word (u16 d, u8 s); 00083 u32 rol_long (u32 d, u8 s); 00084 u8 ror_byte (u8 d, u8 s); 00085 u16 ror_word (u16 d, u8 s); 00086 u32 ror_long (u32 d, u8 s); 00087 u8 shl_byte (u8 d, u8 s); 00088 u16 shl_word (u16 d, u8 s); 00089 u32 shl_long (u32 d, u8 s); 00090 u8 shr_byte (u8 d, u8 s); 00091 u16 shr_word (u16 d, u8 s); 00092 u32 shr_long (u32 d, u8 s); 00093 u8 sar_byte (u8 d, u8 s); 00094 u16 sar_word (u16 d, u8 s); 00095 u32 sar_long (u32 d, u8 s); 00096 u16 shld_word (u16 d, u16 fill, u8 s); 00097 u32 shld_long (u32 d, u32 fill, u8 s); 00098 u16 shrd_word (u16 d, u16 fill, u8 s); 00099 u32 shrd_long (u32 d, u32 fill, u8 s); 00100 u8 sbb_byte (u8 d, u8 s); 00101 u16 sbb_word (u16 d, u16 s); 00102 u32 sbb_long (u32 d, u32 s); 00103 u8 sub_byte (u8 d, u8 s); 00104 u16 sub_word (u16 d, u16 s); 00105 u32 sub_long (u32 d, u32 s); 00106 void test_byte (u8 d, u8 s); 00107 void test_word (u16 d, u16 s); 00108 void test_long (u32 d, u32 s); 00109 u8 xor_byte (u8 d, u8 s); 00110 u16 xor_word (u16 d, u16 s); 00111 u32 xor_long (u32 d, u32 s); 00112 void imul_byte (u8 s); 00113 void imul_word (u16 s); 00114 void imul_long (u32 s); 00115 void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s); 00116 void mul_byte (u8 s); 00117 void mul_word (u16 s); 00118 void mul_long (u32 s); 00119 void idiv_byte (u8 s); 00120 void idiv_word (u16 s); 00121 void idiv_long (u32 s); 00122 void div_byte (u8 s); 00123 void div_word (u16 s); 00124 void div_long (u32 s); 00125 void ins (int size); 00126 void outs (int size); 00127 u16 mem_access_word (int addr); 00128 void push_word (u16 w); 00129 void push_long (u32 w); 00130 u16 pop_word (void); 00131 u32 pop_long (void); 00132 00133 #if defined(__HAVE_INLINE_ASSEMBLER__) && !defined(PRIM_OPS_NO_REDEFINE_ASM) 00134 00135 #define aaa_word(d) aaa_word_asm(&M.x86.R_EFLG,d) 00136 #define aas_word(d) aas_word_asm(&M.x86.R_EFLG,d) 00137 #define aad_word(d) aad_word_asm(&M.x86.R_EFLG,d) 00138 #define aam_word(d) aam_word_asm(&M.x86.R_EFLG,d) 00139 #define adc_byte(d,s) adc_byte_asm(&M.x86.R_EFLG,d,s) 00140 #define adc_word(d,s) adc_word_asm(&M.x86.R_EFLG,d,s) 00141 #define adc_long(d,s) adc_long_asm(&M.x86.R_EFLG,d,s) 00142 #define add_byte(d,s) add_byte_asm(&M.x86.R_EFLG,d,s) 00143 #define add_word(d,s) add_word_asm(&M.x86.R_EFLG,d,s) 00144 #define add_long(d,s) add_long_asm(&M.x86.R_EFLG,d,s) 00145 #define and_byte(d,s) and_byte_asm(&M.x86.R_EFLG,d,s) 00146 #define and_word(d,s) and_word_asm(&M.x86.R_EFLG,d,s) 00147 #define and_long(d,s) and_long_asm(&M.x86.R_EFLG,d,s) 00148 #define cmp_byte(d,s) cmp_byte_asm(&M.x86.R_EFLG,d,s) 00149 #define cmp_word(d,s) cmp_word_asm(&M.x86.R_EFLG,d,s) 00150 #define cmp_long(d,s) cmp_long_asm(&M.x86.R_EFLG,d,s) 00151 #define daa_byte(d) daa_byte_asm(&M.x86.R_EFLG,d) 00152 #define das_byte(d) das_byte_asm(&M.x86.R_EFLG,d) 00153 #define dec_byte(d) dec_byte_asm(&M.x86.R_EFLG,d) 00154 #define dec_word(d) dec_word_asm(&M.x86.R_EFLG,d) 00155 #define dec_long(d) dec_long_asm(&M.x86.R_EFLG,d) 00156 #define inc_byte(d) inc_byte_asm(&M.x86.R_EFLG,d) 00157 #define inc_word(d) inc_word_asm(&M.x86.R_EFLG,d) 00158 #define inc_long(d) inc_long_asm(&M.x86.R_EFLG,d) 00159 #define or_byte(d,s) or_byte_asm(&M.x86.R_EFLG,d,s) 00160 #define or_word(d,s) or_word_asm(&M.x86.R_EFLG,d,s) 00161 #define or_long(d,s) or_long_asm(&M.x86.R_EFLG,d,s) 00162 #define neg_byte(s) neg_byte_asm(&M.x86.R_EFLG,s) 00163 #define neg_word(s) neg_word_asm(&M.x86.R_EFLG,s) 00164 #define neg_long(s) neg_long_asm(&M.x86.R_EFLG,s) 00165 #define not_byte(s) not_byte_asm(&M.x86.R_EFLG,s) 00166 #define not_word(s) not_word_asm(&M.x86.R_EFLG,s) 00167 #define not_long(s) not_long_asm(&M.x86.R_EFLG,s) 00168 #define rcl_byte(d,s) rcl_byte_asm(&M.x86.R_EFLG,d,s) 00169 #define rcl_word(d,s) rcl_word_asm(&M.x86.R_EFLG,d,s) 00170 #define rcl_long(d,s) rcl_long_asm(&M.x86.R_EFLG,d,s) 00171 #define rcr_byte(d,s) rcr_byte_asm(&M.x86.R_EFLG,d,s) 00172 #define rcr_word(d,s) rcr_word_asm(&M.x86.R_EFLG,d,s) 00173 #define rcr_long(d,s) rcr_long_asm(&M.x86.R_EFLG,d,s) 00174 #define rol_byte(d,s) rol_byte_asm(&M.x86.R_EFLG,d,s) 00175 #define rol_word(d,s) rol_word_asm(&M.x86.R_EFLG,d,s) 00176 #define rol_long(d,s) rol_long_asm(&M.x86.R_EFLG,d,s) 00177 #define ror_byte(d,s) ror_byte_asm(&M.x86.R_EFLG,d,s) 00178 #define ror_word(d,s) ror_word_asm(&M.x86.R_EFLG,d,s) 00179 #define ror_long(d,s) ror_long_asm(&M.x86.R_EFLG,d,s) 00180 #define shl_byte(d,s) shl_byte_asm(&M.x86.R_EFLG,d,s) 00181 #define shl_word(d,s) shl_word_asm(&M.x86.R_EFLG,d,s) 00182 #define shl_long(d,s) shl_long_asm(&M.x86.R_EFLG,d,s) 00183 #define shr_byte(d,s) shr_byte_asm(&M.x86.R_EFLG,d,s) 00184 #define shr_word(d,s) shr_word_asm(&M.x86.R_EFLG,d,s) 00185 #define shr_long(d,s) shr_long_asm(&M.x86.R_EFLG,d,s) 00186 #define sar_byte(d,s) sar_byte_asm(&M.x86.R_EFLG,d,s) 00187 #define sar_word(d,s) sar_word_asm(&M.x86.R_EFLG,d,s) 00188 #define sar_long(d,s) sar_long_asm(&M.x86.R_EFLG,d,s) 00189 #define shld_word(d,fill,s) shld_word_asm(&M.x86.R_EFLG,d,fill,s) 00190 #define shld_long(d,fill,s) shld_long_asm(&M.x86.R_EFLG,d,fill,s) 00191 #define shrd_word(d,fill,s) shrd_word_asm(&M.x86.R_EFLG,d,fill,s) 00192 #define shrd_long(d,fill,s) shrd_long_asm(&M.x86.R_EFLG,d,fill,s) 00193 #define sbb_byte(d,s) sbb_byte_asm(&M.x86.R_EFLG,d,s) 00194 #define sbb_word(d,s) sbb_word_asm(&M.x86.R_EFLG,d,s) 00195 #define sbb_long(d,s) sbb_long_asm(&M.x86.R_EFLG,d,s) 00196 #define sub_byte(d,s) sub_byte_asm(&M.x86.R_EFLG,d,s) 00197 #define sub_word(d,s) sub_word_asm(&M.x86.R_EFLG,d,s) 00198 #define sub_long(d,s) sub_long_asm(&M.x86.R_EFLG,d,s) 00199 #define test_byte(d,s) test_byte_asm(&M.x86.R_EFLG,d,s) 00200 #define test_word(d,s) test_word_asm(&M.x86.R_EFLG,d,s) 00201 #define test_long(d,s) test_long_asm(&M.x86.R_EFLG,d,s) 00202 #define xor_byte(d,s) xor_byte_asm(&M.x86.R_EFLG,d,s) 00203 #define xor_word(d,s) xor_word_asm(&M.x86.R_EFLG,d,s) 00204 #define xor_long(d,s) xor_long_asm(&M.x86.R_EFLG,d,s) 00205 #define imul_byte(s) imul_byte_asm(&M.x86.R_EFLG,&M.x86.R_AX,M.x86.R_AL,s) 00206 #define imul_word(s) imul_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,s) 00207 #define imul_long(s) imul_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s) 00208 #define imul_long_direct(res_lo,res_hi,d,s) imul_long_asm(&M.x86.R_EFLG,res_lo,res_hi,d,s) 00209 #define mul_byte(s) mul_byte_asm(&M.x86.R_EFLG,&M.x86.R_AX,M.x86.R_AL,s) 00210 #define mul_word(s) mul_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,s) 00211 #define mul_long(s) mul_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s) 00212 #define idiv_byte(s) idiv_byte_asm(&M.x86.R_EFLG,&M.x86.R_AL,&M.x86.R_AH,M.x86.R_AX,s) 00213 #define idiv_word(s) idiv_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,M.x86.R_DX,s) 00214 #define idiv_long(s) idiv_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,M.x86.R_EDX,s) 00215 #define div_byte(s) div_byte_asm(&M.x86.R_EFLG,&M.x86.R_AL,&M.x86.R_AH,M.x86.R_AX,s) 00216 #define div_word(s) div_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,M.x86.R_DX,s) 00217 #define div_long(s) div_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,M.x86.R_EDX,s) 00218 00219 #endif 00220 00221 #endif /* __X86EMU_PRIM_OPS_H */