- nc = (nc + NBPW-1) & ~(NBPW-1);
- error = getxfile(p, vp, &exdata.ex_exec, paged, nc + (na+4)*NBPW,
- uid, gid);
+
+ /*
+ * XXX the following is excessively bogus
+ *
+ * Compute initial process stack size and location of argc
+ * and character strings. `nc' is currently just the number
+ * of characters of arg and env strings.
+ *
+ * nc = size of ps_strings structure +
+ * size of signal code +
+ * 4 bytes of NULL pointer +
+ * nc,
+ * rounded to nearest integer;
+ * ucp = USRSTACK - nc; [user characters pointer]
+ * apsize = padding (if any) +
+ * 4 bytes of NULL pointer +
+ * ne 4-byte pointers to env strings +
+ * 4 bytes of NULL pointer +
+ * (na-ne) 4-byte pointers to arg strings +
+ * 4 bytes of argc;
+ * (this is the same as nc + (na+3)*4)
+ * ap = ucp - apsize; [user address of argc]
+ * ssize = ssize + nc + machine-dependent space;
+ */
+ nc = (sizeof(ps) + szsigcode + 4 + nc + NBPW-1) & ~(NBPW - 1);
+#ifdef sparc
+ ucp = USRSTACK;
+ ssize = (nc + (na + 3) * NBPW + 7) & ~7;
+ ap = ucp - ssize;
+ ucp -= nc;
+ ssize += sizeof(struct rwindow);
+#else
+ ssize = (na + 3) * NBPW;
+ ucp = USRSTACK - nc;
+ ap = ucp - ssize;
+ ssize += nc;
+#endif
+ error = getxfile(p, vp, &exdata.ex_exec, paged, ssize, uid, gid);