/* Do the new data and stack segment sizes fit in the address space? */
ft = (rmp->mp_flags & SEPARATE);
+#if (CHIP == INTEL && _WORD_SIZE == 2)
r = size_ok(ft, rmp->mp_seg[T].mem_len, rmp->mp_seg[D].mem_len,
rmp->mp_seg[S].mem_len, rmp->mp_seg[D].mem_vir, rmp->mp_seg[S].mem_vir);
+#else
+ r = (rmp->mp_seg[D].mem_vir + rmp->mp_seg[D].mem_len >
+ rmp->mp_seg[S].mem_vir) ? ENOMEM : OK;
+#endif
if (r == OK) {
if (changed) sys_newmap((int)(rmp - mproc), rmp->mp_seg);
return(OK);
return(ENOMEM);
}
-
+#if (CHIP == INTEL && _WORD_SIZE == 2)
/*===========================================================================*
* size_ok *
*===========================================================================*/
* is needed, since the data and stack may not exceed 4096 clicks.
*/
-#if (CHIP == INTEL && _WORD_SIZE == 2)
int pt, pd, ps; /* segment sizes in pages */
pt = ( (tc << CLICK_SHIFT) + PAGE_SIZE - 1)/PAGE_SIZE;
} else {
if (pt + pd + ps > MAX_PAGES) return(ENOMEM);
}
-#endif
if (dvir + dc > s_vir) return(ENOMEM);
return(OK);
}
+#endif
+
+
+
if (dc >= totc) return(ENOEXEC); /* stack must be at least 1 click */
dvir = (*ft == SEPARATE ? 0 : tc);
s_vir = dvir + (totc - sc);
+#if (CHIP == INTEL && _WORD_SIZE == 2)
m = size_ok(*ft, tc, dc, sc, dvir, s_vir);
+#else
+ m = (dvir + dc > s_vir) ? ENOMEM : OK;
+#endif
ct = hdr.a_hdrlen & BYTE; /* header length */
if (ct > A_MINHDR) lseek(fd, (off_t) ct, SEEK_SET); /* skip unused hdr */
return(m);