]> Zhao Yanbai Git Server - minix.git/commitdiff
Zero out to three stack dwords to fix boot errors
authorErik van der Kouwe <erik@minix3.org>
Tue, 24 Aug 2010 12:51:11 +0000 (12:51 +0000)
committerErik van der Kouwe <erik@minix3.org>
Tue, 24 Aug 2010 12:51:11 +0000 (12:51 +0000)
kernel/main.c

index 6f0df871c31c55f9f39a4443fed43aae056f25f9..b95ca5bef281e8ef64a74399b898b47303cc8320 100644 (file)
@@ -38,6 +38,7 @@ PUBLIC int main(void)
   vir_clicks text_clicks, data_clicks, st_clicks;
   reg_t ktsb;                  /* kernel task stack base */
   struct exec e_hdr;           /* for a copy of an a.out header */
+  size_t argsz;                        /* size of arguments passed to crtso on stack */
 
    /* Global value to test segment sanity. */
    magictest = MAGICTEST;
@@ -189,7 +190,12 @@ PUBLIC int main(void)
        if (isusern(proc_nr)) {         /* user-space process? */ 
                rp->p_reg.sp = (rp->p_memmap[S].mem_vir +
                                rp->p_memmap[S].mem_len) << CLICK_SHIFT;
-               rp->p_reg.sp -= 3 * sizeof(reg_t);
+               argsz = 3 * sizeof(reg_t);
+               rp->p_reg.sp -= argsz;
+               phys_memset(rp->p_reg.sp - 
+                       (rp->p_memmap[S].mem_vir << CLICK_SHIFT) +
+                       (rp->p_memmap[S].mem_phys << CLICK_SHIFT), 
+                       0, argsz);
        }
 
        /* scheduling functions depend on proc_ptr pointing somewhere. */