void init_vm(ulong addr, ulong size) { for (int i = 0; i < MAX_LINEAR_HOLE - 1; i++) { linear_holes[i].pnext = &linear_holes[i + 1]; } linear_holes[MAX_LINEAR_HOLE - 1].pnext = 0; pfreeh = linear_holes; phead = 0; init_spinlock(&spin_vm); free_linear(addr, size); }
void _spinlock(spinlock_t *lck) { struct spinlock_extra *_extra; if (!__isthreaded) PANIC("Spinlock called when not threaded."); if (!initialized) PANIC("Spinlocks not initialized."); if (lck->fname == NULL) init_spinlock(lck); _extra = (struct spinlock_extra *)lck->fname; THR_UMUTEX_LOCK(_get_curthread(), &_extra->lock); }