Diff for /np2/i386c/ia32/cpu_mem.c between versions 1.12 and 1.13

version 1.12, 2004/03/05 14:17:35 version 1.13, 2004/03/08 12:56:22
Line 242  cpu_prefetch(UINT32 address) Line 242  cpu_prefetch(UINT32 address)
         UINT length = CPU_PREFETCH_QUEUE_LENGTH - offset;          UINT length = CPU_PREFETCH_QUEUE_LENGTH - offset;
   
         cpu_memory_access_la_region(address, length, CPU_PAGE_READ_CODE, CPU_STAT_USER_MODE, CPU_PREFETCHQ + offset);          cpu_memory_access_la_region(address, length, CPU_PAGE_READ_CODE, CPU_STAT_USER_MODE, CPU_PREFETCHQ + offset);
         CPU_PREFETCHQ_REMAIN = length;          CPU_PREFETCHQ_REMAIN = (SINT8)length;
 }  }
   
 INLINE static MEMCALL UINT8  INLINE static MEMCALL UINT8
Line 276  cpu_prefetchq_3(UINT32 address) Line 276  cpu_prefetchq_3(UINT32 address)
         CPU_PREFETCHQ_REMAIN -= 3;          CPU_PREFETCHQ_REMAIN -= 3;
         p = CPU_PREFETCHQ + (address & CPU_PREFETCHQ_MASK);          p = CPU_PREFETCHQ + (address & CPU_PREFETCHQ_MASK);
         v = LOADINTELWORD(p);          v = LOADINTELWORD(p);
         v += (UINT32)*p << 16;          v += ((UINT32)p[2]) << 16;
         return v;          return v;
 }  }
   
Line 293  cpu_prefetchq_d(UINT32 address) Line 293  cpu_prefetchq_d(UINT32 address)
 }  }
 #endif  /* IA32_SUPPORT_PREFETCH_QUEUE */  #endif  /* IA32_SUPPORT_PREFETCH_QUEUE */
   
   #if defined(IA32_SUPPORT_DEBUG_REGISTER)
   INLINE static void
   check_memory_break_point(UINT32 address, UINT length, UINT rw)
   {
           int i;
   
           if (CPU_STAT_BP && !(CPU_EFLAG & RF_FLAG)) {
                   for (i = 0; i < CPU_DEBUG_REG_INDEX_NUM; i++) {
                           if ((CPU_STAT_BP & (1 << i))
                            && (CPU_DR7_GET_RW(i) & rw)
   
                            && ((address <= CPU_DR(i) && address + length > CPU_DR(i))
                             || (address > CPU_DR(i) && address < CPU_DR(i) + CPU_DR7_GET_LEN(i)))) {
                                   CPU_STAT_BP_EVENT |= CPU_STAT_BP_EVENT_B(i);
                           }
                   }
           }
   }
   #else
   #define check_memory_break_point(address, length, rw)
   #endif
   
 /*  /*
  * code fetch   * code fetch
  */   */
Line 306  cpu_codefetch(UINT32 offset) Line 328  cpu_codefetch(UINT32 offset)
         if (offset <= sd->u.seg.limit) {          if (offset <= sd->u.seg.limit) {
                 addr = sd->u.seg.segbase + offset;                  addr = sd->u.seg.segbase + offset;
 #if defined(IA32_SUPPORT_PREFETCH_QUEUE)  #if defined(IA32_SUPPORT_PREFETCH_QUEUE)
                 if (CPU_PREFETCHQ_REMAIN == 0) {                  if (CPU_PREFETCHQ_REMAIN <= 0) {
                         cpu_prefetch(addr);                          cpu_prefetch(addr);
                 }                  }
                 return cpu_prefetchq(addr);                  return cpu_prefetchq(addr);
 #else   /* IA32_SUPPORT_PREFETCH_QUEUE */  #else   /* !IA32_SUPPORT_PREFETCH_QUEUE */
                 if (!CPU_STAT_PM)                  if (!CPU_STAT_PM)
                         return cpu_memoryread(addr);                          return cpu_memoryread(addr);
                 return cpu_lcmemoryread(addr);                  return cpu_lcmemoryread(addr);
Line 333  cpu_codefetch_w(UINT32 offset) Line 355  cpu_codefetch_w(UINT32 offset)
         if (offset <= sd->u.seg.limit - 1) {          if (offset <= sd->u.seg.limit - 1) {
                 addr = sd->u.seg.segbase + offset;                  addr = sd->u.seg.segbase + offset;
 #if defined(IA32_SUPPORT_PREFETCH_QUEUE)  #if defined(IA32_SUPPORT_PREFETCH_QUEUE)
                 if (CPU_PREFETCHQ_REMAIN == 0) {                  if (CPU_PREFETCHQ_REMAIN <= 0) {
                         cpu_prefetch(addr);                          cpu_prefetch(addr);
                 }                  }
                 if (CPU_PREFETCHQ_REMAIN >= 2) {                  if (CPU_PREFETCHQ_REMAIN >= 2) {
Line 343  cpu_codefetch_w(UINT32 offset) Line 365  cpu_codefetch_w(UINT32 offset)
                 v = cpu_prefetchq(addr);                  v = cpu_prefetchq(addr);
                 addr++;                  addr++;
                 cpu_prefetch(addr);                  cpu_prefetch(addr);
                 v |= cpu_prefetchq(addr) << 8;                  v += (UINT16)cpu_prefetchq(addr) << 8;
                 return v;                  return v;
 #else   /* IA32_SUPPORT_PREFETCH_QUEUE */  #else   /* !IA32_SUPPORT_PREFETCH_QUEUE */
                 if (!CPU_STAT_PM)                  if (!CPU_STAT_PM)
                         return cpu_memoryread_w(addr);                          return cpu_memoryread_w(addr);
                 return cpu_lcmemoryread_w(addr);                  return cpu_lcmemoryread_w(addr);
Line 368  cpu_codefetch_d(UINT32 offset) Line 390  cpu_codefetch_d(UINT32 offset)
         if (offset <= sd->u.seg.limit - 3) {          if (offset <= sd->u.seg.limit - 3) {
                 addr = sd->u.seg.segbase + offset;                  addr = sd->u.seg.segbase + offset;
 #if defined(IA32_SUPPORT_PREFETCH_QUEUE)  #if defined(IA32_SUPPORT_PREFETCH_QUEUE)
                 if (CPU_PREFETCHQ_REMAIN == 0) {                  if (CPU_PREFETCHQ_REMAIN <= 0) {
                         cpu_prefetch(addr);                          cpu_prefetch(addr);
                 }                  }
                 if (CPU_PREFETCHQ_REMAIN >= 4) {                  if (CPU_PREFETCHQ_REMAIN >= 4) {
Line 377  cpu_codefetch_d(UINT32 offset) Line 399  cpu_codefetch_d(UINT32 offset)
                         switch (CPU_PREFETCHQ_REMAIN) {                          switch (CPU_PREFETCHQ_REMAIN) {
                         case 1:                          case 1:
                                 v = cpu_prefetchq(addr);                                  v = cpu_prefetchq(addr);
                                 cpu_prefetch(addr + 1);                                  addr++;
                                 v += (UINT32)cpu_prefetchq_3(addr + 1) << 8;                                  cpu_prefetch(addr);
                                   v += (UINT32)cpu_prefetchq_3(addr) << 8;
                                 break;                                  break;
   
                         case 2:                          case 2:
                                 v = cpu_prefetchq_w(addr);                                  v = cpu_prefetchq_w(addr);
                                 cpu_prefetch(addr + 2);                                  addr += 2;
                                 v += (UINT32)cpu_prefetchq_w(addr + 2) << 16;                                  cpu_prefetch(addr);
                                   v += (UINT32)cpu_prefetchq_w(addr) << 16;
                                 break;                                  break;
   
                         case 3:                          case 3:
                                 v = cpu_prefetchq_3(addr);                                  v = cpu_prefetchq_3(addr);
                                 cpu_prefetch(addr + 3);                                  addr += 3;
                                 v += (UINT32)cpu_prefetchq(addr + 3) << 24;                                  cpu_prefetch(addr);
                                   v += (UINT32)cpu_prefetchq(addr) << 24;
                                 break;                                  break;
                         }                          }
                         return v;                          return v;
                 }                  }
 #else   /* IA32_SUPPORT_PREFETCH_QUEUE */  #else   /* !IA32_SUPPORT_PREFETCH_QUEUE */
                 if (!CPU_STAT_PM)                  if (!CPU_STAT_PM)
                         return cpu_memoryread_d(addr);                          return cpu_memoryread_d(addr);
                 return cpu_lcmemoryread_d(addr);                  return cpu_lcmemoryread_d(addr);
Line 451  cpu_vmemoryread(int idx, UINT32 offset) Line 476  cpu_vmemoryread(int idx, UINT32 offset)
                 }                  }
         }          }
         addr = sd->u.seg.segbase + offset;          addr = sd->u.seg.segbase + offset;
           check_memory_break_point(addr, 1, CPU_DR7_RW_RO);
         if (!CPU_STAT_PM)          if (!CPU_STAT_PM)
                 return cpu_memoryread(addr);                  return cpu_memoryread(addr);
         return cpu_lmemoryread(addr, CPU_STAT_USER_MODE);          return cpu_lmemoryread(addr, CPU_STAT_USER_MODE);
Line 502  cpu_vmemoryread_w(int idx, UINT32 offset Line 528  cpu_vmemoryread_w(int idx, UINT32 offset
                 }                  }
         }           } 
         addr = sd->u.seg.segbase + offset;          addr = sd->u.seg.segbase + offset;
           check_memory_break_point(addr, 2, CPU_DR7_RW_RO);
         if (!CPU_STAT_PM)          if (!CPU_STAT_PM)
                 return cpu_memoryread_w(addr);                  return cpu_memoryread_w(addr);
         return cpu_lmemoryread_w(addr, CPU_STAT_USER_MODE);          return cpu_lmemoryread_w(addr, CPU_STAT_USER_MODE);
Line 553  cpu_vmemoryread_d(int idx, UINT32 offset Line 580  cpu_vmemoryread_d(int idx, UINT32 offset
                 }                  }
         }          }
         addr = sd->u.seg.segbase + offset;          addr = sd->u.seg.segbase + offset;
           check_memory_break_point(addr, 4, CPU_DR7_RW_RO);
         if (!CPU_STAT_PM)          if (!CPU_STAT_PM)
                 return cpu_memoryread_d(addr);                  return cpu_memoryread_d(addr);
         return cpu_lmemoryread_d(addr, CPU_STAT_USER_MODE);          return cpu_lmemoryread_d(addr, CPU_STAT_USER_MODE);
Line 605  cpu_vmemorywrite(int idx, UINT32 offset, Line 633  cpu_vmemorywrite(int idx, UINT32 offset,
                 }                  }
         }          }
         addr = sd->u.seg.segbase + offset;          addr = sd->u.seg.segbase + offset;
           check_memory_break_point(addr, 1, CPU_DR7_RW_RW);
         if (!CPU_STAT_PM) {          if (!CPU_STAT_PM) {
                 /* real mode */                  /* real mode */
                 cpu_memorywrite(addr, val);                  cpu_memorywrite(addr, val);
Line 660  cpu_vmemorywrite_w(int idx, UINT32 offse Line 689  cpu_vmemorywrite_w(int idx, UINT32 offse
                 }                  }
         }          }
         addr = sd->u.seg.segbase + offset;          addr = sd->u.seg.segbase + offset;
           check_memory_break_point(addr, 2, CPU_DR7_RW_RW);
         if (!CPU_STAT_PM) {          if (!CPU_STAT_PM) {
                 /* real mode */                  /* real mode */
                 cpu_memorywrite_w(addr, val);                  cpu_memorywrite_w(addr, val);
Line 715  cpu_vmemorywrite_d(int idx, UINT32 offse Line 745  cpu_vmemorywrite_d(int idx, UINT32 offse
                 }                  }
         }          }
         addr = sd->u.seg.segbase + offset;          addr = sd->u.seg.segbase + offset;
           check_memory_break_point(addr, 4, CPU_DR7_RW_RW);
         if (!CPU_STAT_PM) {          if (!CPU_STAT_PM) {
                 /* real mode */                  /* real mode */
                 cpu_memorywrite_d(addr, val);                  cpu_memorywrite_d(addr, val);

Removed from v.1.12  
changed lines
  Added in v.1.13


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