1997-08-05 22:24:31 +00:00
|
|
|
/*
|
1998-04-25 04:50:03 +00:00
|
|
|
* Copyright (c) 1997, 1998 John S. Dyson
|
1997-08-05 22:24:31 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice immediately at the beginning of the file, without modification,
|
|
|
|
* this list of conditions, and the following disclaimer.
|
1998-04-25 04:50:03 +00:00
|
|
|
* 2. Absolutely no warranty of function or purpose is made by the author
|
1997-08-05 22:24:31 +00:00
|
|
|
* John S. Dyson.
|
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1997-08-05 22:24:31 +00:00
|
|
|
*/
|
|
|
|
|
1999-01-10 01:58:29 +00:00
|
|
|
#ifndef _SYS_ZONE_H
|
1997-08-05 00:07:31 +00:00
|
|
|
|
|
|
|
#define _SYS_ZONE_H
|
|
|
|
|
1997-09-21 11:41:12 +00:00
|
|
|
#define ZONE_INTERRUPT 1 /* Use this if you need to allocate at int time */
|
|
|
|
#define ZONE_BOOT 16 /* This is an internal flag used by zbootinit */
|
1997-08-05 00:07:31 +00:00
|
|
|
|
2001-05-01 08:13:21 +00:00
|
|
|
#include <sys/_lock.h>
|
|
|
|
#include <sys/_mutex.h>
|
1997-08-05 00:07:31 +00:00
|
|
|
|
|
|
|
typedef struct vm_zone {
|
2001-01-22 07:01:50 +00:00
|
|
|
struct mtx zmtx; /* lock for data structure */
|
1997-09-21 11:41:12 +00:00
|
|
|
void *zitems; /* linked list of items */
|
|
|
|
int zfreecnt; /* free entries */
|
|
|
|
int zfreemin; /* minimum number of free entries */
|
|
|
|
int znalloc; /* number of allocations */
|
|
|
|
vm_offset_t zkva; /* Base kva of zone */
|
|
|
|
int zpagecount; /* Total # of allocated pages */
|
|
|
|
int zpagemax; /* Max address space */
|
|
|
|
int zmax; /* Max number of entries allocated */
|
|
|
|
int ztotal; /* Total entries allocated now */
|
|
|
|
int zsize; /* size of each entry */
|
|
|
|
int zalloc; /* hint for # of pages to alloc */
|
|
|
|
int zflags; /* flags for zone */
|
|
|
|
int zallocflag; /* flag for allocation */
|
|
|
|
struct vm_object *zobj; /* object to hold zone */
|
|
|
|
char *zname; /* name for diags */
|
2001-01-22 07:01:50 +00:00
|
|
|
/* NOTE: zent is protected by the subsystem lock, *not* by zmtx */
|
|
|
|
SLIST_ENTRY(vm_zone) zent; /* singly-linked list of zones */
|
1997-08-05 00:07:31 +00:00
|
|
|
} *vm_zone_t;
|
|
|
|
|
|
|
|
|
2001-01-22 07:01:50 +00:00
|
|
|
void vm_zone_init(void);
|
|
|
|
void vm_zone_init2(void);
|
|
|
|
|
|
|
|
int zinitna(vm_zone_t z, struct vm_object *obj, char *name,
|
|
|
|
int size, int nentries, int flags, int zalloc);
|
|
|
|
vm_zone_t zinit(char *name, int size, int nentries,
|
|
|
|
int flags, int zalloc);
|
|
|
|
void zbootinit(vm_zone_t z, char *name, int size,
|
|
|
|
void *item, int nitems);
|
2001-08-04 20:17:05 +00:00
|
|
|
void zdestroy(vm_zone_t z);
|
2001-01-22 07:01:50 +00:00
|
|
|
void *zalloc(vm_zone_t z);
|
|
|
|
void zfree(vm_zone_t z, void *item);
|
1997-08-05 22:24:31 +00:00
|
|
|
|
2000-12-27 02:54:37 +00:00
|
|
|
#endif /* _SYS_ZONE_H */
|