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

emu_decode.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 instruction decoding logic.
00036 *
00037 ****************************************************************************/
00038 
00039 #ifndef __X86EMU_DECODE_H
00040 #define __X86EMU_DECODE_H
00041 
00042 /*---------------------- Macros and type definitions ----------------------*/
00043 
00044 /* Instruction Decoding Stuff */
00045 
00046 #define FETCH_DECODE_MODRM(mod,rh,rl)   fetch_decode_modrm(&mod,&rh,&rl)
00047 #define DECODE_RM_BYTE_REGISTER(r)      decode_rm_byte_register(r)
00048 #define DECODE_RM_WORD_REGISTER(r)      decode_rm_word_register(r)
00049 #define DECODE_RM_LONG_REGISTER(r)      decode_rm_long_register(r)
00050 #define DECODE_CLEAR_SEGOVR()           M.x86.mode &= ~SYSMODE_CLRMASK
00051 
00052 /*-------------------------- Function Prototypes --------------------------*/
00053 
00054 void    x86emu_intr_raise (u8 type);
00055 void    fetch_decode_modrm (int *mod,int *regh,int *regl);
00056 u8      fetch_byte_imm (void);
00057 u16     fetch_word_imm (void);
00058 u32     fetch_long_imm (void);
00059 u8      fetch_data_byte (uint offset);
00060 u8      fetch_data_byte_abs (uint segment, uint offset);
00061 u16     fetch_data_word (uint offset);
00062 u16     fetch_data_word_abs (uint segment, uint offset);
00063 u32     fetch_data_long (uint offset);
00064 u32     fetch_data_long_abs (uint segment, uint offset);
00065 void    store_data_byte (uint offset, u8 val);
00066 void    store_data_byte_abs (uint segment, uint offset, u8 val);
00067 void    store_data_word (uint offset, u16 val);
00068 void    store_data_word_abs (uint segment, uint offset, u16 val);
00069 void    store_data_long (uint offset, u32 val);
00070 void    store_data_long_abs (uint segment, uint offset, u32 val);
00071 u8*     decode_rm_byte_register(int reg);
00072 u16*    decode_rm_word_register(int reg);
00073 u32*    decode_rm_long_register(int reg);
00074 u16*    decode_rm_seg_register(int reg);
00075 unsigned decode_rm00_address(int rm);
00076 unsigned decode_rm01_address(int rm);
00077 unsigned decode_rm10_address(int rm);
00078 
00079 #endif /* __X86EMU_DECODE_H */