-# $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
.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}:
-/* $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 $ */
/*
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;