From: rahnds Date: Thu, 9 Jan 1997 05:21:27 +0000 (+0000) Subject: Fix the SALIB dependancies correctly so that it builds and locates X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=538b9c8aa77d608d5ec4c4c0b901533ef4a7aae5;p=openbsd Fix the SALIB dependancies correctly so that it builds and locates the library. Fix alloc.c so that the piece allocated is of the "correct" size for the current allocation by splitting the buffer. This was required so that free would work correctly if a large buffer was allocated, then freed, the allocated again with a small allocation. --- diff --git a/sys/arch/powerpc/stand/Makefile b/sys/arch/powerpc/stand/Makefile index 9eb01803511..7c3f70bed88 100644 --- a/sys/arch/powerpc/stand/Makefile +++ b/sys/arch/powerpc/stand/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 1996/12/28 06:31:08 rahnds Exp $ +# $OpenBSD: Makefile,v 1.3 1997/01/09 05:21:27 rahnds Exp $ # $NetBSD: Makefile,v 1.1 1996/09/30 16:34:59 ws Exp $ SUBDIR= boot @@ -11,10 +11,10 @@ KERN_AS=library .include "$S/lib/libsa/Makefile.inc" .include "$S/lib/libkern/Makefile.inc" -all: $(SALIB) ${KERNLIB} _SUBDIRUSE +all: ${SALIB} ${KERNLIB} _SUBDIRUSE libdep: - @echo $(SALIB) $(KERNLIB) + @echo ${.OBJDIR}/${SALIB} $(KERNLIB) ${PROG}: diff --git a/sys/arch/powerpc/stand/alloc.c b/sys/arch/powerpc/stand/alloc.c index 3d86db43a9c..65dbf7c6637 100644 --- a/sys/arch/powerpc/stand/alloc.c +++ b/sys/arch/powerpc/stand/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.2 1996/12/28 06:31:10 rahnds Exp $ */ +/* $OpenBSD: alloc.c,v 1.3 1997/01/09 05:21:28 rahnds Exp $ */ /* $NetBSD: alloc.c,v 1.1 1996/09/30 16:35:00 ws Exp $ */ /* @@ -65,8 +65,20 @@ alloc(size) if (f == (void *)-1) panic("alloc"); f->size = rsz; - } else + } else { *fp = f->next; + if (f->size > roundup(size, NBPG)) { + /* if the buffer is larger than necessary, split it */ + /* still rounding to page size */ + struct ml *f1; + f1 = (struct ml *)((u_int)f + roundup(size, NBPG)); + f1->size = f->size - roundup(size, NBPG); + f->size = roundup(size, NBPG); + /* put the unused portion back on free list */ + f1->next = fl; + fl = f1; + } + } f->next = al; al = f;