home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / sim / z8k / tm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-12  |  6.4 KB  |  206 lines

  1. /* tm.h
  2.    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of Z8KSIM
  5.  
  6. Z8KSIM is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. Z8KSIM is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with Z8KSIM; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #ifndef _TM_H
  21. #define _TM_H
  22.  
  23. #ifdef __GNUC__
  24. typedef SFtype __attribute__ ((mode (SF)));
  25. typedef DFtype __attribute__ ((mode (DF)));
  26.  
  27. typedef int HItype __attribute__ ((mode (HI)));
  28. typedef int SItype __attribute__ ((mode (SI)));
  29.  
  30. typedef unsigned int UHItype __attribute__ ((mode (HI)));
  31. typedef unsigned int USItype __attribute__ ((mode (SI)));
  32. #else
  33. typedef float SFtype;
  34. typedef double DFtype;
  35. typedef short int HItype;
  36. typedef long int SItype;
  37. typedef unsigned short UHItype ;
  38. typedef unsigned int USItype ;
  39. #endif
  40.  
  41. typedef struct UDIstruct
  42. {
  43.   USItype high;
  44.   USItype low;
  45. } UDItype;
  46.  
  47. #define BIG_ENDIAN_HOST
  48. typedef unsigned int sim_phys_addr_type;
  49. typedef unsigned int sim_logical_addr_type;
  50.  
  51. #define PAGE_POWER 23        /*  only one pages */
  52.  
  53. #define MAP_PHYSICAL_TO_LOGICAL(x)  (((x >> 8) & 0x7f0000) | (x & 0xffff))
  54. #define MAP_LOGICAL_TO_PHYSICAL(x)  (((x <<8) & 0x7f000000) | (x & 0xffff))
  55. #define REG_PC     17
  56. #define REG_CYCLES 18
  57. #define REG_INSTS  19
  58. #define REG_TIME   20
  59. #define REG_FP     21
  60. #define REG_SP     22
  61. #define REG_CCR    16
  62.  
  63. #define SET_REG(x,y)  set_reg(x,y)
  64. #define SINGLE_STEP 1
  65.  
  66. #define PSW_CARRY context->carry
  67. #define PSW_OP    context->op
  68. #define PSW_OVERFLOW context->overflow
  69. #define PSW_SIGN context->sign
  70. #define PSW_ZERO context->zero
  71. #define GET_PC()  context->pc
  72. #define SET_PC(x) context->pc = x
  73.  
  74. struct op_info
  75. {
  76.   short int exec;
  77. };
  78.  
  79. extern struct op_info op_info_table[];
  80.  
  81. typedef union
  82. {
  83.   unsigned short int word;
  84.   struct
  85.   {
  86.     unsigned char byte[2];
  87.   }
  88.   bytes;
  89. #ifdef BIG_ENDIAN_HOST
  90.   struct
  91.     {
  92.       unsigned char msb;
  93.       unsigned char lsb;
  94.     }
  95.   b;
  96. #endif
  97. }
  98.  
  99. borw_type;
  100.  
  101. typedef struct state_struct
  102. {
  103.   unsigned short *memory;
  104.   int carry;
  105.   int sign;
  106.   int zero;
  107.   int overflow;
  108.   int op;
  109.   int cycles;
  110.  
  111.   borw_type regs[16];
  112.  
  113.   sim_phys_addr_type sometimes_pc;
  114. #ifdef __GNUC__
  115.   volatile
  116. #endif
  117.   int exception;
  118.  
  119. #define iwords_0  iwords0
  120. #define iwords_1  iwords1
  121. #define iwords_2  iwords2
  122. #define iwords_3  iwords3
  123.  
  124. #define ibytes_0    (iwords_0>>8)
  125. #define ibytes_1    (iwords_0&0xff)
  126. #define ibytes_2    (iwords_1>>8)
  127. #define ibytes_3    (iwords_1& 0xff)
  128. #define ibytes_4    (iwords_2>>8)
  129.  
  130.   int insts;
  131.   int ticks;
  132.  
  133.   int next_inst;
  134.   int broken_flags;
  135.  
  136.   int srca;
  137.   int srcb;
  138.   int dst;
  139.   int size;
  140. }
  141.  
  142. sim_state_type;
  143.  
  144. #define CMP_FLAGS 100
  145. #define TST_FLAGS 101
  146. #endif
  147.  
  148. extern int get_word_mem_da PARAMS((sim_state_type *context, int addr)); 
  149. extern int get_word_reg PARAMS((sim_state_type *context, int reg)); 
  150. extern int sim_trace PARAMS((void)); 
  151. extern void support_call PARAMS((sim_state_type *context, int sc)); 
  152. extern void tm_exception PARAMS((int x)); 
  153. extern int tm_read_byte PARAMS((int x)); 
  154. extern int tm_signal PARAMS((void)); 
  155. extern void tm_state PARAMS((sim_state_type *x)); 
  156. extern void tm_write_byte PARAMS((int x, int y)); 
  157. extern void bfop_bad1 PARAMS(()); 
  158. extern int fail PARAMS((sim_state_type *context, int v)); 
  159. extern void fop_bad PARAMS((sim_state_type *context)); 
  160. extern void sfop_bad1 PARAMS(()); 
  161. extern void swap_long PARAMS((char *buf, int val)); 
  162. extern void swap_word PARAMS((char *buf, int val)); 
  163. extern void tm_fetch_register PARAMS((int regno, char *buf)); 
  164. extern void tm_info_print PARAMS((sim_state_type *x)); 
  165. extern void tm_resume PARAMS((int step)); 
  166. extern void tm_store_register PARAMS((int regno, int value)); 
  167.  
  168.  
  169. #ifndef __GNUC__
  170. /* If were using gnuc then these will be inlined, so the prototypes 
  171.  won't be right */
  172. long int sitoptr PARAMS((long int si)); 
  173. long int ptrtosi PARAMS((long int ptr)); 
  174. void put_long_reg PARAMS((sim_state_type *context, int reg, int val)); 
  175. void put_quad_reg PARAMS((sim_state_type *context, int reg, int val1, int val2)); 
  176. void put_word_reg PARAMS((sim_state_type *context, int reg, int val)); 
  177. SItype get_long_reg PARAMS((sim_state_type *context, int reg)); 
  178. void put_byte_reg PARAMS((sim_state_type *context, int reg, int val)); 
  179. int get_byte_reg PARAMS((sim_state_type *context, int reg)); 
  180. void put_word_mem_da PARAMS((sim_state_type *context, int addr, int value)); 
  181. unsigned char get_byte_mem_da PARAMS((sim_state_type *context, int addr)); 
  182. void put_byte_mem_da PARAMS((sim_state_type *context, int addr, int value)); 
  183. SItype get_long_mem_da PARAMS((sim_state_type *context, int addr)); 
  184. void put_long_mem_da PARAMS((sim_state_type *context, int addr, int value)); 
  185. int get_word_mem_ir PARAMS((sim_state_type *context, int reg)); 
  186. void put_word_mem_ir PARAMS((sim_state_type *context, int reg, int value)); 
  187. int get_byte_mem_ir PARAMS((sim_state_type *context, int reg)); 
  188. void put_byte_mem_ir PARAMS((sim_state_type *context, int reg, int value)); 
  189. int get_long_mem_ir PARAMS((sim_state_type *context, int reg)); 
  190. void put_long_mem_ir PARAMS((sim_state_type *context, int reg, int value)); 
  191. void put_long_mem_x PARAMS((sim_state_type *context, int base, int reg, int value)); 
  192. void put_word_mem_x PARAMS((sim_state_type *context, int base, int reg, int value)); 
  193. void put_byte_mem_x PARAMS((sim_state_type *context, int base, int reg, int value)); 
  194. int get_word_mem_x PARAMS((sim_state_type *context, int base, int reg)); 
  195. int get_byte_mem_x PARAMS((sim_state_type *context, int base, int reg)); 
  196. int get_long_mem_x PARAMS((sim_state_type *context, int base, int reg)); 
  197. int COND PARAMS((sim_state_type *context, int c)); 
  198. void NORMAL_FLAGS PARAMS((sim_state_type *context, int size, int dst, int srca, int srcb)); 
  199. void TEST_NORMAL_FLAGS PARAMS((sim_state_type *context, int size, int dst)); 
  200. void put_ptr_long_reg PARAMS((sim_state_type *context, int reg, int val)); 
  201. long int get_ptr_long_reg PARAMS((sim_state_type *context, int reg)); 
  202. long int get_ptr_long_mem_ir PARAMS((sim_state_type *context, int reg)); 
  203. long int get_ptr_long_mem_da PARAMS((sim_state_type *context, long int addr)); 
  204. void put_ptr_long_mem_da PARAMS((sim_state_type *context, long int addr, long int ptr)); 
  205. #endif
  206.