1 /**************************************************************************
3 * Copyright 2006-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA.
5 * Copyright 2009 VMware, Inc., Palo Alto, CA., USA.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
23 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
24 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26 * USE OR OTHER DEALINGS IN THE SOFTWARE.
28 **************************************************************************/
31 * Generic simple memory manager implementation. Intended to be used as a base
32 * class implementation for more advanced memory managers.
34 * Note that the algorithm used is quite simple and there might be substantial
35 * performance gains if a smarter free list is implemented. Currently it is just an
36 * unordered stack of free regions. This could easily be improved if an RB-tree
37 * is used instead. At least if we expect heavy fragmentation.
40 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
46 #include "wsbm_util.h"
49 struct _WsbmListHead fl_entry;
50 struct _WsbmListHead ml_entry;
55 struct _WsbmListHead fl_entry;
56 struct _WsbmListHead ml_entry;
63 extern struct _WsbmMMNode *wsbmMMSearchFree(const struct _WsbmMM *mm,
67 extern struct _WsbmMMNode *wsbmMMGetBlock(struct _WsbmMMNode *parent,
70 extern void wsbmMMPutBlock(struct _WsbmMMNode *cur);
71 extern void wsbmMMtakedown(struct _WsbmMM *mm);
72 extern int wsbmMMinit(struct _WsbmMM *mm, unsigned long start,
74 extern int wsbmMMclean(struct _WsbmMM *mm);