Lines Matching defs:pseg
62 * Any other pseg is automatically created when no space is available
70 /* Bitmap of the segments in use in this pseg. */
76 #define UVM_PSEG_FULL(pseg) ((pseg)->use == (1 << MAX_PAGER_SEGS) - 1)
77 #define UVM_PSEG_EMPTY(pseg) ((pseg)->use == 0)
78 #define UVM_PSEG_INUSE(pseg,id) (((pseg)->use & (1 << (id))) != 0)
116 uvm_pseg_init(struct uvm_pseg *pseg)
118 KASSERT(pseg->start == 0);
119 KASSERT(pseg->use == 0);
120 pseg->start = (vaddr_t)km_alloc(MAX_PAGER_SEGS * MAXBSIZE,
135 struct uvm_pseg *pseg;
140 /* Find first pseg that has room. */
141 for (pseg = &psegs[0]; pseg != &psegs[PSEG_NUMSEGS]; pseg++) {
142 if (UVM_PSEG_FULL(pseg))
145 if (pseg->start == 0) {
147 uvm_pseg_init(pseg);
148 if (pseg->start == 0)
153 if ((pseg == &psegs[0] || pseg == &psegs[1]) &&
160 if (!UVM_PSEG_INUSE(pseg, i)) {
161 pseg->use |= 1 << i;
163 return pseg->start + i * MAXBSIZE;
183 * Deallocates pseg if it is no longer in use.
189 struct uvm_pseg *pseg;
193 for (pseg = &psegs[0]; pseg != &psegs[PSEG_NUMSEGS]; pseg++) {
194 if (pseg->start <= segaddr &&
195 segaddr < pseg->start + MAX_PAGER_SEGS * MAXBSIZE)
198 KASSERT(pseg != &psegs[PSEG_NUMSEGS]);
200 id = (segaddr - pseg->start) / MAXBSIZE;
204 KDASSERT(segaddr == pseg->start + id * MAXBSIZE);
207 KASSERT(UVM_PSEG_INUSE(pseg, id));
209 pseg->use &= ~(1 << id);
212 if ((pseg != &psegs[0] && pseg != &psegs[1]) && UVM_PSEG_EMPTY(pseg)) {
213 va = pseg->start;
214 pseg->start = 0;