libhd  5.0
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 /* $XFree86$ */
00039 
00040 #ifndef __X86EMU_DECODE_H
00041 #define __X86EMU_DECODE_H
00042 
00043 /*---------------------- Macros and type definitions ----------------------*/
00044 
00045 /* Instruction Decoding Stuff */
00046 
00047 #define FETCH_DECODE_MODRM(mod,rh,rl)   fetch_decode_modrm(&mod,&rh,&rl)
00048 #define DECODE_RM_BYTE_REGISTER(r)      decode_rm_byte_register(r)
00049 #define DECODE_RM_WORD_REGISTER(r)      decode_rm_word_register(r)
00050 #define DECODE_RM_LONG_REGISTER(r)      decode_rm_long_register(r)
00051 #define DECODE_CLEAR_SEGOVR()           M.x86.mode &= ~SYSMODE_CLRMASK
00052 
00053 /*-------------------------- Function Prototypes --------------------------*/
00054 
00055 #ifdef  __cplusplus
00056 extern "C" {                                    /* Use "C" linkage when in C++ mode */
00057 #endif
00058 
00059 void    x86emu_intr_raise (u8 type);
00060 void    fetch_decode_modrm (int *mod,int *regh,int *regl);
00061 u8      fetch_byte_imm (void);
00062 u16     fetch_word_imm (void);
00063 u32     fetch_long_imm (void);
00064 u8      fetch_data_byte (uint offset);
00065 u8      fetch_data_byte_abs (uint segment, uint offset);
00066 u16     fetch_data_word (uint offset);
00067 u16     fetch_data_word_abs (uint segment, uint offset);
00068 u32     fetch_data_long (uint offset);
00069 u32     fetch_data_long_abs (uint segment, uint offset);
00070 void    store_data_byte (uint offset, u8 val);
00071 void    store_data_byte_abs (uint segment, uint offset, u8 val);
00072 void    store_data_word (uint offset, u16 val);
00073 void    store_data_word_abs (uint segment, uint offset, u16 val);
00074 void    store_data_long (uint offset, u32 val);
00075 void    store_data_long_abs (uint segment, uint offset, u32 val);
00076 u8*     decode_rm_byte_register(int reg);
00077 u16*    decode_rm_word_register(int reg);
00078 u32*    decode_rm_long_register(int reg);
00079 u16*    decode_rm_seg_register(int reg);
00080 u32     decode_rm00_address(int rm);
00081 u32     decode_rm01_address(int rm);
00082 u32     decode_rm10_address(int rm);
00083 u32     decode_sib_address(int sib, int mod);
00084 
00085 #ifdef  __cplusplus
00086 }                                               /* End of "C" linkage for C++           */
00087 #endif
00088 
00089 #endif /* __X86EMU_DECODE_H */