kernel/vm.c
/*
 * create a direct-map page table for the kernel and
 * turn on paging. called early, in supervisor mode.
 * the page allocator is already initialized.
 */
create a direct-map page table for the kernel and
turn on paging. called early, in supervisor mode.
the page allocator is already initialized.
create a direct - map page table for the kernel and turn on paging . called early in supervisor mode . the page allocator is already initialized .
void
kvminit()
{
  kernel_pagetable = (pagetable_t) kalloc();
  memset(kernel_pagetable, 0, PGSIZE);
  kvmmap(UART0, UART0, PGSIZE, PTE_R | PTE_W);
  kvmmap(VIRTION(0), VIRTION(0), PGSIZE, PTE_R | PTE_W);
  kvmmap(VIRTION(1), VIRTION(1), PGSIZE, PTE_R | PTE_W);
  kvmmap(CLINT, CLINT, 0x10000, PTE_R | PTE_W);
  kvmmap(PLIC, PLIC, 0x400000, PTE_R | PTE_W);
  kvmmap(KERNBASE, KERNBASE, (uint64)etext-KERNBASE, PTE_R | PTE_X);
  kvmmap((uint64)etext, (uint64)etext, PHYSTOP-(uint64)etext, PTE_R | PTE_W);
  kvmmap(TRAMPOLINE, (uint64)trampoline, PGSIZE, PTE_R | PTE_X);
}
void kvminit ( ) { kernel_pagetable = ( pagetable_t ) kalloc ( ) ; memset ( kernel_pagetable , 0 , PGSIZE ) ; kvmmap ( UART0 , UART0 , PGSIZE , PTE_R | PTE_W ) ; kvmmap ( VIRTION ( 0 ) , VIRTION ( 0 ) , PGSIZE , PTE_R | PTE_W ) ; kvmmap ( VIRTION ( 1 ) , VIRTION ( 1 ) , PGSIZE , PTE_R | PTE_W ) ; kvmmap ( CLINT , CLINT , 0x10000 , PTE_R | PTE_W ) ; kvmmap ( PLIC , PLIC , 0x400000 , PTE_R | PTE_W ) ; kvmmap ( KERNBASE , KERNBASE , ( uint64 ) etext - KERNBASE , PTE_R | PTE_X ) ; kvmmap ( ( uint64 ) etext , ( uint64 ) etext , PHYSTOP - ( uint64 ) etext , PTE_R | PTE_W ) ; kvmmap ( TRAMPOLINE , ( uint64 ) trampoline , PGSIZE , PTE_R | PTE_X ) ; }
create a direct-map page table for the kernel and
 turn on paging.
create a direct - map page table for the kernel and turn on paging .
// uart registers // virtio mmio disk interface 0 // virtio mmio disk interface 1 // CLINT // PLIC // map kernel text executable and read-only. // map kernel data and the physical RAM we'll make use of. // map the trampoline for trap entry/exit to // the highest virtual address in the kernel.