Diff for /np2/i386c/ia32/cpu.h between versions 1.19 and 1.25

version 1.19, 2004/02/20 16:09:04 version 1.25, 2004/03/12 13:34:08
Line 109  enum { Line 109  enum {
 };  };
   
 enum {  enum {
         CPU_DEBUG_REG_NUM = 8          CPU_DEBUG_REG_NUM = 8,
           CPU_DEBUG_REG_INDEX_NUM = 4
 };  };
   
 enum {  enum {
         MAX_PREFIX = 8          MAX_PREFIX = 8
 };  };
   
   enum {
           CPU_PREFETCH_QUEUE_LENGTH = 16
   };
   
 typedef struct {  typedef struct {
         REG32           reg[CPU_REG_NUM];          REG32           reg[CPU_REG_NUM];
         UINT16          sreg[CPU_SEGREG_NUM];          UINT16          sreg[CPU_SEGREG_NUM];
Line 152  typedef struct { Line 157  typedef struct {
         descriptor_t    ldtr;          descriptor_t    ldtr;
         descriptor_t    tr;          descriptor_t    tr;
   
           BYTE            prefetch[CPU_PREFETCH_QUEUE_LENGTH];
           SINT8           prefetch_remain;
           UINT8           pad2[3];
   
         UINT32          adrsmask;          UINT32          adrsmask;
         UINT32          ovflag;          UINT32          ovflag;
   
Line 167  typedef struct { Line 176  typedef struct {
         UINT8           user_mode;          UINT8           user_mode;
   
         UINT8           hlt;          UINT8           hlt;
         UINT8           pad[3];          UINT8           bp;     /* break point bitmap */
           UINT8           bp_ev;  /* break point event */
           UINT8           pad;
   
         UINT32          pde_base;          UINT32          pde_base;
   
Line 395  do { \ Line 406  do { \
 #define ALL_FLAG        (SZAPC_FLAG|T_FLAG|I_FLAG|D_FLAG|O_FLAG|IOPL_FLAG|NT_FLAG)  #define ALL_FLAG        (SZAPC_FLAG|T_FLAG|I_FLAG|D_FLAG|O_FLAG|IOPL_FLAG|NT_FLAG)
 #define ALL_EFLAG       (ALL_FLAG|RF_FLAG|VM_FLAG|AC_FLAG|VIF_FLAG|VIP_FLAG|ID_FLAG)  #define ALL_EFLAG       (ALL_FLAG|RF_FLAG|VM_FLAG|AC_FLAG|VIF_FLAG|VIP_FLAG|ID_FLAG)
   
 #define REAL_FLAGREG    ((CPU_FLAG & 0xf7ff) | (CPU_OV ? O_FLAG : 0))  #define REAL_FLAGREG    ((CPU_FLAG & 0xf7ff) | (CPU_OV ? O_FLAG : 0) | 2)
 #define REAL_EFLAGREG   ((CPU_EFLAG & 0xfffff7ff) | (CPU_OV ? O_FLAG : 0))  #define REAL_EFLAGREG   ((CPU_EFLAG & 0xfffff7ff) | (CPU_OV ? O_FLAG : 0) | 2)
   
   #if !defined(IA32_DONT_USE_SET_EFLAGS_FUNCTION)
 void set_flags(UINT16 new_flags, UINT16 mask);  void set_flags(UINT16 new_flags, UINT16 mask);
 void set_eflags(UINT32 new_flags, UINT32 mask);  void set_eflags(UINT32 new_flags, UINT32 mask);
   #endif
   
   
 #define CPU_INST_OP32           CPU_STATSAVE.cpu_inst.op_32  #define CPU_INST_OP32           CPU_STATSAVE.cpu_inst.op_32
Line 441  void set_eflags(UINT32 new_flags, UINT32 Line 454  void set_eflags(UINT32 new_flags, UINT32
 #define CPU_STAT_EXCEPTION_COUNTER_INC()        CPU_STATSAVE.cpu_stat.nerror++  #define CPU_STAT_EXCEPTION_COUNTER_INC()        CPU_STATSAVE.cpu_stat.nerror++
 #define CPU_STAT_EXCEPTION_COUNTER_CLEAR()      CPU_STATSAVE.cpu_stat.nerror = 0  #define CPU_STAT_EXCEPTION_COUNTER_CLEAR()      CPU_STATSAVE.cpu_stat.nerror = 0
   
   #define CPU_PREFETCHQ           CPU_STATSAVE.cpu_stat.prefetch
   #define CPU_PREFETCHQ_REMAIN    CPU_STATSAVE.cpu_stat.prefetch_remain
   
   #if defined(IA32_SUPPORT_PREFETCH_QUEUE)
   #define CPU_PREFETCH_CLEAR()    CPU_PREFETCHQ_REMAIN = 0
   #else   /* !IA32_SUPPORT_PREFETCH_QUEUE */
   #define CPU_PREFETCH_CLEAR()
   #endif  /* IA32_SUPPORT_PREFETCH_QUEUE */
   
 #define CPU_MODE_SUPERVISER     0  #define CPU_MODE_SUPERVISER     0
 #define CPU_MODE_USER           1  #define CPU_MODE_USER           1
 #define CPU_SET_CPL(cpl) \  #define CPU_SET_CPL(cpl) \
Line 459  do { \ Line 481  do { \
 #define CPU_STI \  #define CPU_STI \
 do { \  do { \
         CPU_FLAG |= I_FLAG; \          CPU_FLAG |= I_FLAG; \
         CPU_TRAP = (CPU_FLAG >> 8) & 1; \          CPU_TRAP = (CPU_FLAG & (I_FLAG|T_FLAG)) == (I_FLAG|T_FLAG) ; \
 } while (/*CONSTCOND*/0)  } while (/*CONSTCOND*/0)
   
 #define CPU_GDTR_LIMIT  CPU_STATSAVE.cpu_sysregs.gdtr_limit  #define CPU_GDTR_LIMIT  CPU_STATSAVE.cpu_sysregs.gdtr_limit
Line 518  do { \ Line 540  do { \
 #define CPU_CR4_OSFXSR          (1 << 9)  #define CPU_CR4_OSFXSR          (1 << 9)
 #define CPU_CR4_OSXMMEXCPT      (1 << 10)  #define CPU_CR4_OSXMMEXCPT      (1 << 10)
   
   /*
    * debug register
    */
   #define CPU_DR(r)               CPU_STATSAVE.cpu_regs.dr[(r)]
   #define CPU_DR6                 CPU_DR(6)
   #define CPU_DR7                 CPU_DR(7)
   
   #define CPU_STAT_BP             CPU_STATSAVE.cpu_stat.bp
   #define CPU_STAT_BP_EVENT       CPU_STATSAVE.cpu_stat.bp_ev
   #define CPU_STAT_BP_EVENT_B(r)  (1 << (r))
   #define CPU_STAT_BP_EVENT_DR    (1 << 4)        /* fault */
   #define CPU_STAT_BP_EVENT_STEP  (1 << 5)        /* as CPU_TRAP */
   #define CPU_STAT_BP_EVENT_TASK  (1 << 6)
   #define CPU_STAT_BP_EVENT_RF    (1 << 7)        /* RF_FLAG */
   
   #define CPU_DR6_B(r)            (1 << (r))
   #define CPU_DR6_BD              (1 << 13)
   #define CPU_DR6_BS              (1 << 14)
   #define CPU_DR6_BT              (1 << 15)
   
   #define CPU_DR7_L(r)            (1 << ((r) * 2))
   #define CPU_DR7_G(r)            (1 << ((r) * 2 + 1))
   #define CPU_DR7_LE              (1 << 8)
   #define CPU_DR7_GE              (1 << 9)
   #define CPU_DR7_GD              (1 << 13)
   #define CPU_DR7_RW(r)           (3 << ((r) * 4 + 16))
   #define CPU_DR7_LEN(r)          (3 << ((r) * 4 + 16 + 2))
   
   #define CPU_DR7_GET_RW(r)       ((CPU_DR7) >> (16 + (r) * 4))
   #define CPU_DR7_RW_CODE         0
   #define CPU_DR7_RW_RO           1
   #define CPU_DR7_RW_IO           2
   #define CPU_DR7_RW_RW           3
   
   #define CPU_DR7_GET_LEN(r)      ((CPU_DR7) >> (16 + 2 + (r) * 4))
   
 void ia32_init(void);  void ia32_init(void);
 void ia32_initreg(void);  void ia32_initreg(void);
Line 526  void ia32_setextsize(UINT32 size); Line 583  void ia32_setextsize(UINT32 size);
 void ia32reset(void);  void ia32reset(void);
 void ia32shut(void);  void ia32shut(void);
 void ia32(void);  void ia32(void);
 void ia32withtrap(void);  
 void ia32withdma(void);  
   
 void ia32_step(void);  void ia32_step(void);
 void CPUCALL ia32_interrupt(int vect);  void CPUCALL ia32_interrupt(int vect, int soft);
 void CPUCALL ia32_exception(int vect, int p1, int p2);  void CPUCALL ia32_exception(int vect, int p1, int p2);
   
 void exec_1step(void);  void exec_1step(void);
Line 538  void exec_1step(void); Line 592  void exec_1step(void);
 #define INST_STRING     (1 << 1)  #define INST_STRING     (1 << 1)
 #define REP_CHECKZF     (1 << 7)  #define REP_CHECKZF     (1 << 7)
   
 int disasm(UINT32 *eip, char *buf, size_t size);  
   
 void ia32_printf(const char *buf, ...);  void ia32_printf(const char *buf, ...);
 void ia32_warning(const char *buf, ...);  void ia32_warning(const char *buf, ...);
 void ia32_panic(const char *buf, ...);  void ia32_panic(const char *buf, ...);
Line 581  void idtr_dump(UINT32 base, UINT limit); Line 633  void idtr_dump(UINT32 base, UINT limit);
 void ldtr_dump(UINT32 base, UINT limit);  void ldtr_dump(UINT32 base, UINT limit);
 void tr_dump(UINT16 selector, UINT32 base, UINT limit);  void tr_dump(UINT16 selector, UINT32 base, UINT limit);
   
   /*
    * disasm
    */
   /* context */
   typedef struct {
           UINT32 val;
   
           UINT32 eip;
           BOOL op32;
           BOOL as32;
   
           UINT32 baseaddr;
           UINT8 opcode[3];
           UINT8 modrm;
           UINT8 sib;
   
           BOOL useseg;
           int seg;
   
           UINT8 opbyte[32];
           int nopbytes;
   
           char str[256];
           size_t remain;
   
           char *next;
           char *prefix;
           char *op;
           char *arg[3];
           int narg;
   
           char pad;
   } disasm_context_t;
   
   int disasm(UINT32 *eip, disasm_context_t *ctx);
   
   
 #ifdef __cplusplus  #ifdef __cplusplus
 }  }
 #endif  #endif

Removed from v.1.19  
changed lines
  Added in v.1.25


RetroPC.NET-CVS <cvs@retropc.net>