decode.h 3.7 KB

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