diff options
author | Dale S. Rahn <rahnds@cvs.openbsd.org> | 1997-01-09 05:21:29 +0000 |
---|---|---|
committer | Dale S. Rahn <rahnds@cvs.openbsd.org> | 1997-01-09 05:21:29 +0000 |
commit | 21a76fbec44d441c2ef0820b48b93b5ccebfa0eb (patch) | |
tree | f15b5aa1f9c144eb5cd5c7490f67e803e3af58a3 /sys/arch/powerpc | |
parent | 3b11b9e219c38c91b491e55470d4f29e7094bb9c (diff) |
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.
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r-- | sys/arch/powerpc/stand/Makefile | 6 | ||||
-rw-r--r-- | sys/arch/powerpc/stand/alloc.c | 16 |
2 files changed, 17 insertions, 5 deletions
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; |