Deleted Added
full compact
kern_malloc.c (33756) kern_malloc.c (34266)
1/*
2 * Copyright (c) 1987, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
1/*
2 * Copyright (c) 1987, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
34 * $Id: kern_malloc.c,v 1.43 1998/02/09 06:09:22 eivind Exp $
34 * $Id: kern_malloc.c,v 1.44 1998/02/23 07:41:23 dyson Exp $
35 */
36
37#include "opt_vm.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#define MALLOC_INSTANTIATE

--- 80 unchanged lines hidden (view full) ---

123#endif
124 register struct malloc_type *ksp = type;
125
126 if (!type->ks_next)
127 malloc_init(type);
128
129 indx = BUCKETINDX(size);
130 kbp = &bucket[indx];
35 */
36
37#include "opt_vm.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#define MALLOC_INSTANTIATE

--- 80 unchanged lines hidden (view full) ---

123#endif
124 register struct malloc_type *ksp = type;
125
126 if (!type->ks_next)
127 malloc_init(type);
128
129 indx = BUCKETINDX(size);
130 kbp = &bucket[indx];
131 s = splhigh();
131 s = splmem();
132 while (ksp->ks_memuse >= ksp->ks_limit) {
133 if (flags & M_NOWAIT) {
134 splx(s);
135 return ((void *) NULL);
136 }
137 if (ksp->ks_limblocks < 65535)
138 ksp->ks_limblocks++;
139 tsleep((caddr_t)ksp, PSWP+2, type->ks_shortdesc, 0);

--- 123 unchanged lines hidden (view full) ---

263#ifdef DIAGNOSTIC
264 if ((char *)addr < kmembase || (char *)addr >= kmemlimit) {
265 panic("free: address 0x%x out of range", addr);
266 }
267#endif
268 kup = btokup(addr);
269 size = 1 << kup->ku_indx;
270 kbp = &bucket[kup->ku_indx];
132 while (ksp->ks_memuse >= ksp->ks_limit) {
133 if (flags & M_NOWAIT) {
134 splx(s);
135 return ((void *) NULL);
136 }
137 if (ksp->ks_limblocks < 65535)
138 ksp->ks_limblocks++;
139 tsleep((caddr_t)ksp, PSWP+2, type->ks_shortdesc, 0);

--- 123 unchanged lines hidden (view full) ---

263#ifdef DIAGNOSTIC
264 if ((char *)addr < kmembase || (char *)addr >= kmemlimit) {
265 panic("free: address 0x%x out of range", addr);
266 }
267#endif
268 kup = btokup(addr);
269 size = 1 << kup->ku_indx;
270 kbp = &bucket[kup->ku_indx];
271 s = splhigh();
271 s = splmem();
272#ifdef DIAGNOSTIC
273 /*
274 * Check for returns of data that do not point to the
275 * beginning of the allocation.
276 */
277 if (size > PAGE_SIZE)
278 alloc = addrmask[BUCKETINDX(PAGE_SIZE)];
279 else

--- 175 unchanged lines hidden ---
272#ifdef DIAGNOSTIC
273 /*
274 * Check for returns of data that do not point to the
275 * beginning of the allocation.
276 */
277 if (size > PAGE_SIZE)
278 alloc = addrmask[BUCKETINDX(PAGE_SIZE)];
279 else

--- 175 unchanged lines hidden ---