45e9809aff7304721fddb95654901b32195c9c7avboxsync/****************************************************************************
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Realmode X86 Emulator Library
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Copyright (C) 1996-1999 SciTech Software, Inc.
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Copyright (C) David Mosberger-Tang
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Copyright (C) 1999 Egbert Eich
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync* ========================================================================
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Permission to use, copy, modify, distribute, and sell this software and
45e9809aff7304721fddb95654901b32195c9c7avboxsync* its documentation for any purpose is hereby granted without fee,
45e9809aff7304721fddb95654901b32195c9c7avboxsync* provided that the above copyright notice appear in all copies and that
45e9809aff7304721fddb95654901b32195c9c7avboxsync* both that copyright notice and this permission notice appear in
45e9809aff7304721fddb95654901b32195c9c7avboxsync* supporting documentation, and that the name of the authors not be used
45e9809aff7304721fddb95654901b32195c9c7avboxsync* in advertising or publicity pertaining to distribution of the software
45e9809aff7304721fddb95654901b32195c9c7avboxsync* without specific, written prior permission. The authors makes no
45e9809aff7304721fddb95654901b32195c9c7avboxsync* representations about the suitability of this software for any purpose.
45e9809aff7304721fddb95654901b32195c9c7avboxsync* It is provided "as is" without express or implied warranty.
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
45e9809aff7304721fddb95654901b32195c9c7avboxsync* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
45e9809aff7304721fddb95654901b32195c9c7avboxsync* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync* PERFORMANCE OF THIS SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync* ========================================================================
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Language: ANSI C
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Environment: Any
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Developer: Kendall Bennett
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Description: Header file for instruction decoding logic.
45e9809aff7304721fddb95654901b32195c9c7avboxsync*
45e9809aff7304721fddb95654901b32195c9c7avboxsync****************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef __X86EMU_DECODE_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __X86EMU_DECODE_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*---------------------- Macros and type definitions ----------------------*/
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Instruction Decoding Stuff */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*-------------------------- Function Prototypes --------------------------*/
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef __cplusplus
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern "C" { /* Use "C" linkage when in C++ mode */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid x86emu_intr_raise (u8 type);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid fetch_decode_modrm (int *mod,int *regh,int *regl);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu8 fetch_byte_imm (void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu16 fetch_word_imm (void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu32 fetch_long_imm (void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu8 fetch_data_byte (uint offset);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu8 fetch_data_byte_abs (uint segment, uint offset);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu16 fetch_data_word (uint offset);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu16 fetch_data_word_abs (uint segment, uint offset);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu32 fetch_data_long (uint offset);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu32 fetch_data_long_abs (uint segment, uint offset);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid store_data_byte (uint offset, u8 val);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid store_data_byte_abs (uint segment, uint offset, u8 val);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid store_data_word (uint offset, u16 val);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid store_data_word_abs (uint segment, uint offset, u16 val);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid store_data_long (uint offset, u32 val);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid store_data_long_abs (uint segment, uint offset, u32 val);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu8* decode_rm_byte_register(int reg);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu16* decode_rm_word_register(int reg);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu32* decode_rm_long_register(int reg);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu16* decode_rm_seg_register(int reg);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu32 decode_rm00_address(int rm);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu32 decode_rm01_address(int rm);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu32 decode_rm10_address(int rm);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncu32 decode_sib_address(int sib, int mod);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef __cplusplus
45e9809aff7304721fddb95654901b32195c9c7avboxsync} /* End of "C" linkage for C++ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* __X86EMU_DECODE_H */