1*ece92f85SJason Jin /**************************************************************************** 2*ece92f85SJason Jin * 3*ece92f85SJason Jin * Realmode X86 Emulator Library 4*ece92f85SJason Jin * 5*ece92f85SJason Jin * Copyright (C) 1991-2004 SciTech Software, Inc. 6*ece92f85SJason Jin * Copyright (C) David Mosberger-Tang 7*ece92f85SJason Jin * Copyright (C) 1999 Egbert Eich 8*ece92f85SJason Jin * 9*ece92f85SJason Jin * ======================================================================== 10*ece92f85SJason Jin * 11*ece92f85SJason Jin * Permission to use, copy, modify, distribute, and sell this software and 12*ece92f85SJason Jin * its documentation for any purpose is hereby granted without fee, 13*ece92f85SJason Jin * provided that the above copyright notice appear in all copies and that 14*ece92f85SJason Jin * both that copyright notice and this permission notice appear in 15*ece92f85SJason Jin * supporting documentation, and that the name of the authors not be used 16*ece92f85SJason Jin * in advertising or publicity pertaining to distribution of the software 17*ece92f85SJason Jin * without specific, written prior permission. The authors makes no 18*ece92f85SJason Jin * representations about the suitability of this software for any purpose. 19*ece92f85SJason Jin * It is provided "as is" without express or implied warranty. 20*ece92f85SJason Jin * 21*ece92f85SJason Jin * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 22*ece92f85SJason Jin * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 23*ece92f85SJason Jin * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 24*ece92f85SJason Jin * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 25*ece92f85SJason Jin * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 26*ece92f85SJason Jin * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 27*ece92f85SJason Jin * PERFORMANCE OF THIS SOFTWARE. 28*ece92f85SJason Jin * 29*ece92f85SJason Jin * ======================================================================== 30*ece92f85SJason Jin * 31*ece92f85SJason Jin * Language: ANSI C 32*ece92f85SJason Jin * Environment: Any 33*ece92f85SJason Jin * Developer: Kendall Bennett 34*ece92f85SJason Jin * 35*ece92f85SJason Jin * Description: Header file for instruction decoding logic. 36*ece92f85SJason Jin * 37*ece92f85SJason Jin ****************************************************************************/ 38*ece92f85SJason Jin 39*ece92f85SJason Jin #ifndef __X86EMU_DECODE_H 40*ece92f85SJason Jin #define __X86EMU_DECODE_H 41*ece92f85SJason Jin 42*ece92f85SJason Jin /*---------------------- Macros and type definitions ----------------------*/ 43*ece92f85SJason Jin 44*ece92f85SJason Jin /* Instruction Decoding Stuff */ 45*ece92f85SJason Jin 46*ece92f85SJason Jin #define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl) 47*ece92f85SJason Jin #define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r) 48*ece92f85SJason Jin #define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r) 49*ece92f85SJason Jin #define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r) 50*ece92f85SJason Jin #define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK 51*ece92f85SJason Jin 52*ece92f85SJason Jin /*-------------------------- Function Prototypes --------------------------*/ 53*ece92f85SJason Jin 54*ece92f85SJason Jin #ifdef __cplusplus 55*ece92f85SJason Jin extern "C" { /* Use "C" linkage when in C++ mode */ 56*ece92f85SJason Jin #endif 57*ece92f85SJason Jin 58*ece92f85SJason Jin void x86emu_intr_raise (u8 type); 59*ece92f85SJason Jin void fetch_decode_modrm (int *mod,int *regh,int *regl); 60*ece92f85SJason Jin u8 fetch_byte_imm (void); 61*ece92f85SJason Jin u16 fetch_word_imm (void); 62*ece92f85SJason Jin u32 fetch_long_imm (void); 63*ece92f85SJason Jin u8 fetch_data_byte (uint offset); 64*ece92f85SJason Jin u8 fetch_data_byte_abs (uint segment, uint offset); 65*ece92f85SJason Jin u16 fetch_data_word (uint offset); 66*ece92f85SJason Jin u16 fetch_data_word_abs (uint segment, uint offset); 67*ece92f85SJason Jin u32 fetch_data_long (uint offset); 68*ece92f85SJason Jin u32 fetch_data_long_abs (uint segment, uint offset); 69*ece92f85SJason Jin void store_data_byte (uint offset, u8 val); 70*ece92f85SJason Jin void store_data_byte_abs (uint segment, uint offset, u8 val); 71*ece92f85SJason Jin void store_data_word (uint offset, u16 val); 72*ece92f85SJason Jin void store_data_word_abs (uint segment, uint offset, u16 val); 73*ece92f85SJason Jin void store_data_long (uint offset, u32 val); 74*ece92f85SJason Jin void store_data_long_abs (uint segment, uint offset, u32 val); 75*ece92f85SJason Jin u8* decode_rm_byte_register(int reg); 76*ece92f85SJason Jin u16* decode_rm_word_register(int reg); 77*ece92f85SJason Jin u32* decode_rm_long_register(int reg); 78*ece92f85SJason Jin u16* decode_rm_seg_register(int reg); 79*ece92f85SJason Jin unsigned decode_rm00_address(int rm); 80*ece92f85SJason Jin unsigned decode_rm01_address(int rm); 81*ece92f85SJason Jin unsigned decode_rm10_address(int rm); 82*ece92f85SJason Jin unsigned decode_rmXX_address(int mod, int rm); 83*ece92f85SJason Jin 84*ece92f85SJason Jin #ifdef __cplusplus 85*ece92f85SJason Jin } /* End of "C" linkage for C++ */ 86*ece92f85SJason Jin #endif 87*ece92f85SJason Jin 88*ece92f85SJason Jin #endif /* __X86EMU_DECODE_H */ 89