Diff for /np2/i386c/ia32/cpu_mem.c between versions 1.26 and 1.28

version 1.26, 2012/01/08 08:05:47 version 1.28, 2012/01/08 11:32:16
Line 64  check_limit_upstairs(descriptor_t *sdp,  Line 64  check_limit_upstairs(descriptor_t *sdp, 
                         if (!SEG_IS_32BIT(sdp)) {                          if (!SEG_IS_32BIT(sdp)) {
                                 if ((len > limit)               /* len check */                                  if ((len > limit)               /* len check */
                                  || (end > limit)) {            /* [1] */                                   || (end > limit)) {            /* [1] */
                                         return 0;                                          goto exc;
                                 }                                  }
                         } else {                          } else {
                                 sdp->flag |= CPU_DESC_FLAG_WHOLEADR;                                  sdp->flag |= CPU_DESC_FLAG_WHOLEADR;
Line 88  check_limit_upstairs(descriptor_t *sdp,  Line 88  check_limit_upstairs(descriptor_t *sdp, 
                          || (end < offset)                      /* wrap check */                           || (end < offset)                      /* wrap check */
                          || (offset < sdp->u.seg.limit)         /* [1] */                           || (offset < sdp->u.seg.limit)         /* [1] */
                          || (end > limit)) {                    /* [2] */                           || (end > limit)) {                    /* [2] */
                                 return 0;                                  goto exc;
                         }                          }
                 }                  }
         } else {          } else {
Line 107  check_limit_upstairs(descriptor_t *sdp,  Line 107  check_limit_upstairs(descriptor_t *sdp, 
                         if (!SEG_IS_32BIT(sdp)) {                          if (!SEG_IS_32BIT(sdp)) {
                                 if ((len > limit)               /* len check */                                  if ((len > limit)               /* len check */
                                  || (offset + len > limit)) {   /* [1] */                                   || (offset + len > limit)) {   /* [1] */
                                         return 0;                                          goto exc;
                                 }                                  }
                         } else {                          } else {
                                 sdp->flag |= CPU_DESC_FLAG_WHOLEADR;                                  sdp->flag |= CPU_DESC_FLAG_WHOLEADR;
Line 127  check_limit_upstairs(descriptor_t *sdp,  Line 127  check_limit_upstairs(descriptor_t *sdp, 
                          */                           */
                         if ((len > sdp->u.seg.limit)            /* len check */                          if ((len > sdp->u.seg.limit)            /* len check */
                          || (end < offset)                      /* wrap check */                           || (end < offset)                      /* wrap check */
                          || (end > sdp->u.seg.limit)) {         /* [1] */                           || (end > sdp->u.seg.limit + 1)) {     /* [1] */
                                 return 0;                                  goto exc;
                         }                          }
                 }                  }
         }          }
         return 1;       /* Ok! */          return 1;       /* Ok! */
   
   exc:
           VERBOSE(("check_limit_upstairs: check failure: offset = 0x%08x, len = %d", offset, len + 1));
   #if defined(DEBUG)
           segdesc_dump(sdp);
   #endif
           return 0;
 }  }
   
 static void MEMCALL  static void MEMCALL
Line 170  cpu_memoryread_check(descriptor_t *sdp,  Line 177  cpu_memoryread_check(descriptor_t *sdp, 
         return;          return;
   
 exc:  exc:
         VERBOSE(("cpu_memoryread_check: check failure."));          VERBOSE(("cpu_memoryread_check: check failure: offset = 0x%08x, len = %d", offset, len));
         VERBOSE(("offset = 0x%08x, len = %d", offset, len));  
 #if defined(DEBUG)  #if defined(DEBUG)
         segdesc_dump(sdp);          segdesc_dump(sdp);
 #endif  #endif
Line 210  cpu_memorywrite_check(descriptor_t *sdp, Line 216  cpu_memorywrite_check(descriptor_t *sdp,
         return;          return;
   
 exc:  exc:
         VERBOSE(("cpu_memorywrite_check: check failure."));          VERBOSE(("cpu_memorywrite_check: check failure: offset = 0x%08x, len = %d", offset, len));
         VERBOSE(("offset = 0x%08x, len = %d", offset, len));  
 #if defined(DEBUG)  #if defined(DEBUG)
         segdesc_dump(sdp);          segdesc_dump(sdp);
 #endif  #endif
Line 227  cpu_stack_push_check(UINT16 s, descripto Line 232  cpu_stack_push_check(UINT16 s, descripto
         __ASSERT(sdp != NULL);          __ASSERT(sdp != NULL);
         __ASSERT(len > 0);          __ASSERT(len > 0);
   
           len--;
   
         if (!SEG_IS_VALID(sdp)          if (!SEG_IS_VALID(sdp)
          || !SEG_IS_PRESENT(sdp)           || !SEG_IS_PRESENT(sdp)
          || SEG_IS_SYSTEM(sdp)           || SEG_IS_SYSTEM(sdp)
Line 235  cpu_stack_push_check(UINT16 s, descripto Line 242  cpu_stack_push_check(UINT16 s, descripto
                 goto exc;                  goto exc;
         }          }
   
         len--;  
         start = sp - len;          start = sp - len;
         limit = SEG_IS_32BIT(sdp) ? 0xffffffff : 0x0000ffff;          limit = SEG_IS_32BIT(sdp) ? 0xffffffff : 0x0000ffff;
         VERBOSE(("cpu_stack_push_check: start=0x%08x, limit=0x%08x", start, limit));  
   
         if (SEG_IS_EXPANDDOWN_DATA(sdp)) {          if (SEG_IS_EXPANDDOWN_DATA(sdp)) {
                 /* expand-down stack */                  /* expand-down stack */
                 VERBOSE(("cpu_stack_push_check: expand-down stack"));  
                 if (!SEG_IS_32BIT(sdp)) {                  if (!SEG_IS_32BIT(sdp)) {
                         if (sp > limit) {                       /* [*] */                          if (sp > limit) {                       /* [*] */
                                 goto exc;                                  goto exc;
Line 287  cpu_stack_push_check(UINT16 s, descripto Line 291  cpu_stack_push_check(UINT16 s, descripto
                 }                  }
         } else {          } else {
                 /* expand-up stack */                  /* expand-up stack */
                 VERBOSE(("cpu_stack_push_check: expand-up stack"));  
                 if (sdp->u.seg.limit == limit) {                  if (sdp->u.seg.limit == limit) {
                         /*                          /*
                          *   32bit       16bit                           *   32bit       16bit
Line 323  cpu_stack_push_check(UINT16 s, descripto Line 326  cpu_stack_push_check(UINT16 s, descripto
                          */                           */
                         if ((len > sdp->u.seg.limit)            /* len check */                          if ((len > sdp->u.seg.limit)            /* len check */
                          || (start > sp)                        /* wrap check */                           || (start > sp)                        /* wrap check */
                          || (sp > sdp->u.seg.limit)) {          /* [1] */                           || (sp > sdp->u.seg.limit + 1)) {      /* [1] */
                                 goto exc;                                  goto exc;
                         }                          }
                 }                  }
Line 331  cpu_stack_push_check(UINT16 s, descripto Line 334  cpu_stack_push_check(UINT16 s, descripto
         return;          return;
   
 exc:  exc:
         VERBOSE(("cpu_stack_push_check: check failure."));          VERBOSE(("cpu_stack_push_check: check failure: selector = %04x, sp = 0x%08x, len = %d", s, sp, len));
         VERBOSE(("cpu_stack_push_check: selector = %04x, sp = 0x%08x, len = %d", s, sp, len + 1));  
 #if defined(DEBUG)  #if defined(DEBUG)
         segdesc_dump(sdp);          segdesc_dump(sdp);
 #endif  #endif
Line 359  cpu_stack_pop_check(UINT16 s, descriptor Line 361  cpu_stack_pop_check(UINT16 s, descriptor
         return;          return;
   
 exc:  exc:
         VERBOSE(("cpu_stack_pop_check: check failure."));          VERBOSE(("cpu_stack_pop_check: check failure: selector = %04x, sp = 0x%08x, len = %d", s, sp, len));
         VERBOSE(("s = 0x%04x, sp = 0x%08x, len = %d", s, sp, len));  
 #if defined(DEBUG)  #if defined(DEBUG)
         segdesc_dump(sdp);          segdesc_dump(sdp);
 #endif  #endif

Removed from v.1.26  
changed lines
  Added in v.1.28


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