From: Ben Gras Date: Fri, 5 Aug 2005 16:56:02 +0000 (+0000) Subject: Al's patch sent Fri aug 5 X-Git-Tag: v3.1.0~416 X-Git-Url: http://zhaoyanbai.com/repos/doc/html/static/gitweb.css?a=commitdiff_plain;h=5d2588aedfbc3c7cbdeef1859c3a19ae48249d2c;p=minix.git Al's patch sent Fri aug 5 --- diff --git a/servers/pm/break.c b/servers/pm/break.c index 111a5d0c0..a337f61e0 100644 --- a/servers/pm/break.c +++ b/servers/pm/break.c @@ -114,8 +114,13 @@ vir_bytes sp; /* new value of sp */ /* 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); @@ -131,7 +136,7 @@ vir_bytes sp; /* new value of sp */ return(ENOMEM); } - +#if (CHIP == INTEL && _WORD_SIZE == 2) /*===========================================================================* * size_ok * *===========================================================================*/ @@ -150,7 +155,6 @@ vir_clicks s_vir; /* virtual address for start of stack seg */ * 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; @@ -162,9 +166,12 @@ vir_clicks s_vir; /* virtual address for start of stack seg */ } else { if (pt + pd + ps > MAX_PAGES) return(ENOMEM); } -#endif if (dvir + dc > s_vir) return(ENOMEM); return(OK); } +#endif + + + diff --git a/servers/pm/exec.c b/servers/pm/exec.c index 108cb6349..335fe35ec 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -275,7 +275,11 @@ vir_bytes *pc; /* program entry point (initial PC) */ 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);