Пример #1
0
// Initialization happens in two phases.
// 1. main() calls kinit1() while still using entrypgdir to place just
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
  initlock(&kmem.lock, "kmem");
  kmem.use_lock = 0;
  freerange(vstart, vend);
}
Пример #2
0
// Initialization happens in two phases.
// 1. main() calls kinit1() while still using entrypgdir to place just
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
    initlock(&kmem.lock, "kmem");
    kmem.use_lock = 0;
    freerange(vstart, vend);
	cprintf("+%x\n", kmem.freelist);
}
Пример #3
0
void
initmem1(void *start, void *end)
{
    initlock(&kmem.lock);
    kmem.freelist = 0;

    // interrupts aren't set up yet, so we can't call lock/unlock
    kmem.uselock = 0;

    freerange(start, end);
}
Пример #4
0
void
kinit2(void *vstart, void *vend)
{
  freerange(vstart, vend);
  kmem.use_lock = 1;
}
Пример #5
0
void
initmem2(void *start, void *end)
{
    freerange(start, end);
    kmem.uselock = 1;
}
Пример #6
0
//-------------------------------------------------------------------------------------------------------------------
// kinit2() -- the late initialization for the memory structures.  It will free all the remaining paged that are
//             covered by the full paging tables available to all processors.
//-------------------------------------------------------------------------------------------------------------------
void kinit2(void *vstart, void *vend)
{
    freerange(vstart, vend);
    kmem.use_lock = 1;              // now, we need to enforce locking
}
Пример #7
0
//-------------------------------------------------------------------------------------------------------------------
// kinit1() -- the early initialization of memory.  It will free the pages that are initially mapped in the startup
//             page table (with 1M pages).
//-------------------------------------------------------------------------------------------------------------------
void kinit1(void *vstart, void *vend)
{
    initlock(&kmem.lock, "kmem");
    kmem.use_lock = 0;              // no need to use the lock yet
    freerange(vstart, vend);
}
Пример #8
0
void kinit(void *vstart, void *vend)
{
  freerange(vstart, vend);
}