2 * Copyright (C) 1999 Egbert Eich
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee,
6 * provided that the above copyright notice appear in all copies and that
7 * both that copyright notice and this permission notice appear in
8 * supporting documentation, and that the name of the authors not be used
9 * in advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. The authors makes no
11 * representations about the suitability of this software for any purpose.
12 * It is provided "as is" without express or implied warranty.
14 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
18 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
22 * xserver/hw/xfree86/int10/generic.c
25 #include <sys/cdefs.h>
26 __FBSDID("$FreeBSD$");
28 #include <sys/param.h>
30 #include <compat/x86bios/x86bios.h>
32 extern u_char *pbiosMem;
33 extern int busySegMap[5];
36 x86biosAlloc(int count, int *segs)
41 /* find the free segblock of page */
42 for (i = 0; i < (PAGE_RESERV - count); i++)
44 if (busySegMap[i] == 0)
46 /* find the capacity of segblock */
47 for (j = i; j < (i + count); j++)
49 if (busySegMap[j] == 1)
59 if (i == (PAGE_RESERV - count))
62 /* make the segblock is used */
63 for (j = i; j < (i + count); j++)
68 return (pbiosMem + *segs);
72 x86biosFree(void *pbuf, int count)
77 busySeg = ((u_char *)pbuf - pbiosMem) / 4096;
79 for (i = busySeg; i < (busySeg + count); i++)