Diff for /np2/i386c/ia32/instructions/arith.mcr between versions 1.1 and 1.6

version 1.1, 2004/03/23 15:29:34 version 1.6, 2012/01/08 19:09:40
Line 1 Line 1
 /*      $Id$    */  
   
 /*  /*
  * Copyright (c) 2004 NONAKA Kimihiro   * Copyright (c) 2004 NONAKA Kimihiro
  * All rights reserved.   * All rights reserved.
Line 12 Line 10
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products  
  *    derived from this software without specific prior written permission.  
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Line 32 Line 28
   
 /* args == 1 */  /* args == 1 */
 #define ARITH_INSTRUCTION_1(inst) \  #define ARITH_INSTRUCTION_1(inst) \
 static UINT32 \  static UINT32 CPUCALL \
 inst##1(UINT32 dst, void *arg) \  inst##1(UINT32 dst, void *arg) \
 { \  { \
         (void)arg; \  
         BYTE_##inst(dst); \          BYTE_##inst(dst); \
         return dst; \          return dst; \
 } \  } \
 static UINT32 \  static UINT32 CPUCALL \
 inst##2(UINT32 dst, void *arg) \  inst##2(UINT32 dst, void *arg) \
 { \  { \
         (void)arg; \  
         WORD_##inst(dst); \          WORD_##inst(dst); \
         return dst; \          return dst; \
 } \  } \
 static UINT32 \  static UINT32 CPUCALL \
 inst##4(UINT32 dst, void *arg) \  inst##4(UINT32 dst, void *arg) \
 { \  { \
         (void)arg; \  
         DWORD_##inst(dst); \          DWORD_##inst(dst); \
         return dst; \          return dst; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_Eb(UINT32 op) \  inst##_Eb(UINT32 op) \
 { \  { \
         UINT8 *out; \          UINT8 *out; \
Line 69  inst##_Eb(UINT32 op) \ Line 62  inst##_Eb(UINT32 op) \
         } else { \          } else { \
                 CPU_WORKCLOCK(5); \                  CPU_WORKCLOCK(5); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW(CPU_INST_SEGREG_INDEX, madr, inst##1, 0); \                  cpu_vmemory_RMW_b(CPU_INST_SEGREG_INDEX, madr, inst##1, 0); \
         } \          } \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_Ew(UINT32 op) \  inst##_Ew(UINT32 op) \
 { \  { \
         UINT16 *out; \          UINT16 *out; \
Line 88  inst##_Ew(UINT32 op) \ Line 81  inst##_Ew(UINT32 op) \
         } else { \          } else { \
                 CPU_WORKCLOCK(5); \                  CPU_WORKCLOCK(5); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, 0); \                  cpu_vmemory_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, 0); \
         } \          } \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_Ed(UINT32 op) \  inst##_Ed(UINT32 op) \
 { \  { \
         UINT32 *out; \          UINT32 *out; \
Line 107  inst##_Ed(UINT32 op) \ Line 100  inst##_Ed(UINT32 op) \
         } else { \          } else { \
                 CPU_WORKCLOCK(5); \                  CPU_WORKCLOCK(5); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, 0); \                  cpu_vmemory_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, 0); \
         } \          } \
 }  }
   
 /* args == 2 */  /* args == 2 */
 #define ARITH_INSTRUCTION_2(inst) \  #define ARITH_INSTRUCTION_2(inst) \
 static UINT32 \  static UINT32 CPUCALL \
 inst##1(UINT32 dst, void *arg) \  inst##1(UINT32 dst, void *arg) \
 { \  { \
         UINT32 src = PTR_TO_UINT32(arg); \          UINT32 src = PTR_TO_UINT32(arg); \
         BYTE_##inst(dst, src); \          BYTE_##inst(dst, src); \
         return dst; \          return dst; \
 } \  } \
 static UINT32 \  static UINT32 CPUCALL \
 inst##2(UINT32 dst, void *arg) \  inst##2(UINT32 dst, void *arg) \
 { \  { \
         UINT32 src = PTR_TO_UINT32(arg); \          UINT32 src = PTR_TO_UINT32(arg); \
         WORD_##inst(dst, src); \          WORD_##inst(dst, src); \
         return dst; \          return dst; \
 } \  } \
 static UINT32 \  static UINT32 CPUCALL \
 inst##4(UINT32 dst, void *arg) \  inst##4(UINT32 dst, void *arg) \
 { \  { \
         UINT32 src = PTR_TO_UINT32(arg); \          UINT32 src = PTR_TO_UINT32(arg); \
Line 151  inst##_EbGb(void) \ Line 144  inst##_EbGb(void) \
         } else { \          } else { \
                 CPU_WORKCLOCK(7); \                  CPU_WORKCLOCK(7); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW(CPU_INST_SEGREG_INDEX, madr, inst##1, UINT32_TO_PTR(src)); \                  cpu_vmemory_RMW_b(CPU_INST_SEGREG_INDEX, madr, inst##1, UINT32_TO_PTR(src)); \
         } \          } \
 } \  } \
 \  \
Line 171  inst##_EwGw(void) \ Line 164  inst##_EwGw(void) \
         } else { \          } else { \
                 CPU_WORKCLOCK(7); \                  CPU_WORKCLOCK(7); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, UINT32_TO_PTR(src)); \                  cpu_vmemory_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, UINT32_TO_PTR(src)); \
         } \          } \
 } \  } \
 \  \
Line 191  inst##_EdGd(void) \ Line 184  inst##_EdGd(void) \
         } else { \          } else { \
                 CPU_WORKCLOCK(7); \                  CPU_WORKCLOCK(7); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, UINT32_TO_PTR(src)); \                  cpu_vmemory_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, UINT32_TO_PTR(src)); \
         } \          } \
 } \  } \
 \  \
Line 267  inst##_EAXId(void) \ Line 260  inst##_EAXId(void) \
         CPU_EAX = dst; \          CPU_EAX = dst; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EbIb(UINT8 *regp, UINT32 src) \  inst##_EbIb(UINT8 *regp, UINT32 src) \
 { \  { \
         UINT32 dst; \          UINT32 dst; \
Line 277  inst##_EbIb(UINT8 *regp, UINT32 src) \ Line 270  inst##_EbIb(UINT8 *regp, UINT32 src) \
         *regp = (UINT8)dst; \          *regp = (UINT8)dst; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EbIb_ext(UINT32 madr, UINT32 src) \  inst##_EbIb_ext(UINT32 madr, UINT32 src) \
 { \  { \
 \  \
         cpu_memory_access_va_RMW(CPU_INST_SEGREG_INDEX, madr, inst##1, UINT32_TO_PTR(src)); \          cpu_vmemory_RMW_b(CPU_INST_SEGREG_INDEX, madr, inst##1, UINT32_TO_PTR(src)); \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EwIx(UINT16 *regp, UINT32 src) \  inst##_EwIx(UINT16 *regp, UINT32 src) \
 { \  { \
         UINT32 dst; \          UINT32 dst; \
Line 294  inst##_EwIx(UINT16 *regp, UINT32 src) \ Line 287  inst##_EwIx(UINT16 *regp, UINT32 src) \
         *regp = (UINT16)dst; \          *regp = (UINT16)dst; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EwIx_ext(UINT32 madr, UINT32 src) \  inst##_EwIx_ext(UINT32 madr, UINT32 src) \
 { \  { \
 \  \
         cpu_memory_access_va_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, UINT32_TO_PTR(src)); \          cpu_vmemory_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, UINT32_TO_PTR(src)); \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EdIx(UINT32 *regp, UINT32 src) \  inst##_EdIx(UINT32 *regp, UINT32 src) \
 { \  { \
         UINT32 dst; \          UINT32 dst; \
Line 311  inst##_EdIx(UINT32 *regp, UINT32 src) \ Line 304  inst##_EdIx(UINT32 *regp, UINT32 src) \
         *regp = dst; \          *regp = dst; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EdIx_ext(UINT32 madr, UINT32 src) \  inst##_EdIx_ext(UINT32 madr, UINT32 src) \
 { \  { \
 \  \
         cpu_memory_access_va_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, UINT32_TO_PTR(src)); \          cpu_vmemory_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, UINT32_TO_PTR(src)); \
 }  }
   
 /* args == 3 */  /* args == 3 */
 #define ARITH_INSTRUCTION_3(inst) \  #define ARITH_INSTRUCTION_3(inst) \
 static UINT32 \  static UINT32 CPUCALL \
 inst##1(UINT32 dst, void *arg) \  inst##1(UINT32 dst, void *arg) \
 { \  { \
         UINT32 src = PTR_TO_UINT32(arg); \          UINT32 src = PTR_TO_UINT32(arg); \
Line 328  inst##1(UINT32 dst, void *arg) \ Line 321  inst##1(UINT32 dst, void *arg) \
         BYTE_##inst(res, dst, src); \          BYTE_##inst(res, dst, src); \
         return res; \          return res; \
 } \  } \
 static UINT32 \  static UINT32 CPUCALL \
 inst##2(UINT32 dst, void *arg) \  inst##2(UINT32 dst, void *arg) \
 { \  { \
         UINT32 src = PTR_TO_UINT32(arg); \          UINT32 src = PTR_TO_UINT32(arg); \
Line 336  inst##2(UINT32 dst, void *arg) \ Line 329  inst##2(UINT32 dst, void *arg) \
         WORD_##inst(res, dst, src); \          WORD_##inst(res, dst, src); \
         return res; \          return res; \
 } \  } \
 static UINT32 \  static UINT32 CPUCALL \
 inst##4(UINT32 dst, void *arg) \  inst##4(UINT32 dst, void *arg) \
 { \  { \
         UINT32 src = PTR_TO_UINT32(arg); \          UINT32 src = PTR_TO_UINT32(arg); \
Line 361  inst##_EbGb(void) \ Line 354  inst##_EbGb(void) \
         } else { \          } else { \
                 CPU_WORKCLOCK(7); \                  CPU_WORKCLOCK(7); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW(CPU_INST_SEGREG_INDEX, madr, inst##1, UINT32_TO_PTR(src)); \                  cpu_vmemory_RMW_b(CPU_INST_SEGREG_INDEX, madr, inst##1, UINT32_TO_PTR(src)); \
         } \          } \
 } \  } \
 \  \
Line 381  inst##_EwGw(void) \ Line 374  inst##_EwGw(void) \
         } else { \          } else { \
                 CPU_WORKCLOCK(7); \                  CPU_WORKCLOCK(7); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, UINT32_TO_PTR(src)); \                  cpu_vmemory_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, UINT32_TO_PTR(src)); \
         } \          } \
 } \  } \
 \  \
Line 401  inst##_EdGd(void) \ Line 394  inst##_EdGd(void) \
         } else { \          } else { \
                 CPU_WORKCLOCK(7); \                  CPU_WORKCLOCK(7); \
                 madr = calc_ea_dst(op); \                  madr = calc_ea_dst(op); \
                 cpu_memory_access_va_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, UINT32_TO_PTR(src)); \                  cpu_vmemory_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, UINT32_TO_PTR(src)); \
         } \          } \
 } \  } \
 \  \
Line 477  inst##_EAXId(void) \ Line 470  inst##_EAXId(void) \
         CPU_EAX = res; \          CPU_EAX = res; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EbIb(UINT8 *regp, UINT32 src) \  inst##_EbIb(UINT8 *regp, UINT32 src) \
 { \  { \
         UINT32 dst, res; \          UINT32 dst, res; \
Line 487  inst##_EbIb(UINT8 *regp, UINT32 src) \ Line 480  inst##_EbIb(UINT8 *regp, UINT32 src) \
         *regp = (UINT8)res; \          *regp = (UINT8)res; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EbIb_ext(UINT32 madr, UINT32 src) \  inst##_EbIb_ext(UINT32 madr, UINT32 src) \
 { \  { \
 \  \
         cpu_memory_access_va_RMW(CPU_INST_SEGREG_INDEX, madr, inst##1, UINT32_TO_PTR(src)); \          cpu_vmemory_RMW_b(CPU_INST_SEGREG_INDEX, madr, inst##1, UINT32_TO_PTR(src)); \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EwIx(UINT16 *regp, UINT32 src) \  inst##_EwIx(UINT16 *regp, UINT32 src) \
 { \  { \
         UINT32 dst, res; \          UINT32 dst, res; \
Line 504  inst##_EwIx(UINT16 *regp, UINT32 src) \ Line 497  inst##_EwIx(UINT16 *regp, UINT32 src) \
         *regp = (UINT16)res; \          *regp = (UINT16)res; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EwIx_ext(UINT32 madr, UINT32 src) \  inst##_EwIx_ext(UINT32 madr, UINT32 src) \
 { \  { \
 \  \
         cpu_memory_access_va_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, UINT32_TO_PTR(src)); \          cpu_vmemory_RMW_w(CPU_INST_SEGREG_INDEX, madr, inst##2, UINT32_TO_PTR(src)); \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EdIx(UINT32 *regp, UINT32 src) \  inst##_EdIx(UINT32 *regp, UINT32 src) \
 { \  { \
         UINT32 dst, res; \          UINT32 dst, res; \
Line 521  inst##_EdIx(UINT32 *regp, UINT32 src) \ Line 514  inst##_EdIx(UINT32 *regp, UINT32 src) \
         *regp = res; \          *regp = res; \
 } \  } \
 \  \
 void \  void CPUCALL \
 inst##_EdIx_ext(UINT32 madr, UINT32 src) \  inst##_EdIx_ext(UINT32 madr, UINT32 src) \
 { \  { \
 \  \
         cpu_memory_access_va_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, UINT32_TO_PTR(src)); \          cpu_vmemory_RMW_d(CPU_INST_SEGREG_INDEX, madr, inst##4, UINT32_TO_PTR(src)); \
 }  }
   
 #endif  /* IA32_CPU_ARITH_MCR__ */  #endif  /* IA32_CPU_ARITH_MCR__ */

Removed from v.1.1  
changed lines
  Added in v.1.6


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