root / Whitix / branches / network / include / pg_alloc.h

Revision 1, 1.5 kB (checked in by mtw07, 11 months ago)

Initial import of projects.

Line 
1/*  This file is part of Whitix.
2 *
3 *  Whitix is free software; you can redistribute it and/or modify
4 *  it under the terms of the GNU General Public License as published by
5 *  the Free Software Foundation; either version 2 of the License, or
6 *  (at your option) any later version.
7 *
8 *  Whitix is distributed in the hope that it will be useful,
9 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *  GNU General Public License for more details.
12 *
13 *  You should have received a copy of the GNU General Public License
14 *  along with Whitix; if not, write to the Free Software
15 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16 *
17 */
18
19#ifndef PG_ALLOC_H
20#define PG_ALLOC_H
21
22#include <llist.h>
23#include <typedefs.h>
24#include <wait.h>
25
26/* One per physical page in the system */
27struct PhysPage
28{
29        DWORD physAddr;
30        int refs;
31        struct ListHead list;
32};
33
34int PageEarlyInit(DWORD endPfn);
35int PageInit();
36struct PhysPage* PageGetStruct(DWORD physAddr);
37struct PhysPage* PageAlloc();
38struct PhysPage* PageAllocLow();
39void PageFree(struct PhysPage* page);
40void PageReserveArea(DWORD start,DWORD size);
41WaitQueue* PageGetWaitQueue(struct PhysPage* page);
42
43#define PageGet(page) ((page)->refs++)
44#define PutPage(page) do { (page)->refs--; if (!(page)->refs) PageFree((page)); } while (0)
45#define CopyPage(dest,src) memcpy((dest),(src),PAGE_SIZE)
46
47#endif
Note: See TracBrowser for help on using the browser.