1 /* $NetBSD: pdsim.h,v 1.1 2006/09/30 08:47:39 yamt Exp $ */
4 * Copyright (c)2006 YAMAMOTO Takashi,
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include <sys/queue.h>
40 #define PAGE_SIZE (1 << PAGE_SHIFT)
41 #define PAGE_MASK (PAGE_SIZE - 1)
43 #define PDPOL_EVCNT_DEFINE(name) int pdpol_evcnt_##name = 0;
44 #define PDPOL_EVCNT_INCR(ev) pdpol_evcnt_##ev++
48 typedef int boolean_t
;
56 struct vm_page
*an_page
; /* XXX */
60 TAILQ_ENTRY(vm_page
) pageq
;
61 struct uvm_object
*uobject
;
64 #define PQ_SWAPBACKED (PQ_ANON|PQ_AOBJ)
65 #define PQ_FREE 0x0001
66 #define PQ_ANON 0x0002
67 #define PQ_AOBJ 0x0004
68 #define PQ_PRIVATE1 0x0100
69 #define PQ_PRIVATE2 0x0200
70 #define PQ_PRIVATE3 0x0400
71 #define PQ_PRIVATE4 0x0800
72 #define PQ_PRIVATE5 0x1000
73 #define PQ_PRIVATE6 0x2000
74 #define PQ_PRIVATE7 0x4000
75 #define PQ_PRIVATE8 0x8000
78 #define MDPG_REFERENCED 1
79 #define MDPG_SPECULATIVE 2
82 struct vm_anon
*uanon
;
88 TAILQ_HEAD(pglist
, vm_page
);
90 boolean_t
pmap_clear_reference(struct vm_page
*);
91 boolean_t
pmap_is_referenced(struct vm_page
*);
106 extern struct uvmexp uvmexp
;
108 #define UVM_LOCK_ASSERT_PAGEQ() /* nothing */
109 #define KASSERT(x) assert(x)
111 static void panic(const char *, ...) __unused
;
113 panic(const char *fmt
, ...)
118 vfprintf(stderr
, fmt
, ap
);
120 fprintf(stderr
, "\n");
127 struct vm_page
*pages
[MAXID
];
130 struct uvm_pctparam
{
133 #define UVM_PCTPARAM_APPLY(pct, x) \
134 (((x) * (pct)->pct_pct) / 100)
135 #define uvm_pctparam_init(pct, x, f) (pct)->pct_pct = x
137 #define UVM_OBJ_IS_VTEXT(o) FALSE
138 #define UVM_OBJ_IS_AOBJ(o) FALSE
139 #define UVM_OBJ_IS_VNODE(o) TRUE
141 #define uvm_swapisfull() TRUE
142 #define uvmpd_trydropswap(p) (panic("dropswap"), 0)
144 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
145 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
147 #if ((__STDC_VERSION__ - 0) >= 199901L)
148 #define WARN(...) fprintf(stderr, __VA_ARGS__)
149 #else /* ((__STDC_VERSION__ - 0) >= 199901L) */
150 #define WARN(a...) fprintf(stderr, a)
151 #endif /* ((__STDC_VERSION__ - 0) >= 199901L) */
154 #if ((__STDC_VERSION__ - 0) >= 199901L)
155 #define DPRINTF(...) printf(__VA_ARGS__)
156 #else /* ((__STDC_VERSION__ - 0) >= 199901L) */
157 #define DPRINTF(a...) printf(a) /* GCC */
158 #endif /* ((__STDC_VERSION__ - 0) >= 199901L) */
159 #define dump(s) pdsim_dump(s)
160 void dump(const char *);
162 #if ((__STDC_VERSION__ - 0) >= 199901L)
163 #define DPRINTF(...) /* nothing */
164 #else /* ((__STDC_VERSION__ - 0) >= 199901L) */
165 #define DPRINTF(a...) /* nothing */ /* GCC */
166 #endif /* ((__STDC_VERSION__ - 0) >= 199901L) */
167 #define dump(s) /* nothing */
170 #include "uvm/uvm_pdpolicy.h"