diff --git a/trap.c b/trap.c index d201990..f26024b 100644 --- a/trap.c +++ b/trap.c @@ -126,8 +126,10 @@ trap(struct trapframe *tf) } cprintf("trap %d from cpu %d eip %x\n", v, cpu(), tf->eip); - if(curproc[cpu()]) + if(curproc[cpu()]) { cprintf("pid %d\n", curproc[cpu()]->pid); + proc_exit(); + } // panic("trap"); return; diff --git a/umalloc.c b/umalloc.c index 11d816a..cdf099e 100644 --- a/umalloc.c +++ b/umalloc.c @@ -26,8 +26,6 @@ free(void *ap) { Header *bp, *p; - printf(1, "free\n"); - bp = (Header *) ap - 1; for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) @@ -53,7 +51,6 @@ morecore(uint nu) if (nu < PAGE) nu = PAGE; - printf(1, "call sbrk\n"); cp = sbrk(nu * sizeof(Header)); if (cp == (char *) -1) return 0; @@ -69,8 +66,6 @@ malloc(uint nbytes) Header *p, *prevp; uint nunits; - printf(1, "malloc %d\n", nbytes); - nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if ((prevp = freep) == 0) { base.s.ptr = freep = prevp = &base; @@ -86,7 +81,6 @@ malloc(uint nbytes) p->s.size = nunits; } freep = prevp; - printf(1, "malloc returns: %d\n", (int) (p+1)); return (void *) (p + 1); } if (p == freep) diff --git a/usertests.c b/usertests.c index cb01c92..2b8b64f 100644 --- a/usertests.c +++ b/usertests.c @@ -120,20 +120,8 @@ exitwait(void) void mem(void) { - void *m = malloc(4096); void *m1, *m2; - free(m + 3*1024); - free(m + 2*1024); - free(m + 1024); - free(m); - m1 = malloc(4096); - if (m1 != m) { - puts("didn't coalesce\n"); - exit(); - } - free(m1); - m1 = 0; while ((m2 = malloc(1024)) != 0) { *(char **) m2 = m1;