vm.c
// Switch TSS and h/w page table to correspond to process p.
Switch TSS and h/w page table to correspond to process p.
Switch TSS and h / w page table to correspond to process p .
void
switchuvm(struct proc *p)
{
  pushcli();
  cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
  cpu->gdt[SEG_TSS].s = 0;
  cpu->ts.ss0 = SEG_KDATA << 3;
  cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
  ltr(SEG_TSS << 3);
  if(p->pgdir == 0)
    panic("switchuvm: no pgdir");
  lcr3(v2p(p->pgdir));  
  popcli();
}
void switchuvm ( struct proc * p ) { pushcli ( ) ; cpu -> gdt [ SEG_TSS ] = SEG16 ( STS_T32A , & cpu -> ts , sizeof ( cpu -> ts ) - 1 , 0 ) ; cpu -> gdt [ SEG_TSS ] . s = 0 ; cpu -> ts . ss0 = SEG_KDATA << 3 ; cpu -> ts . esp0 = ( uint ) proc -> kstack + KSTACKSIZE ; ltr ( SEG_TSS << 3 ) ; if ( p -> pgdir == 0 ) panic ( " " ) ; lcr3 ( v2p ( p -> pgdir ) ) ; popcli ( ) ; }
Switch TSS and h/w page table to correspond to process p.
Switch TSS and h / w page table to correspond to process p .
// switch to new address space