procsave()

procsave()

概要

引数

実装

  598: /*
  599:  *  Save the mach dependent part of the process state.
  600:  */
  601: void
  602: procsave(Proc *p)
  603: {
  604:         uvlong t;
  605: 
  606:         cycles(&t);
  607:         p->pcycles += t;
  608:         if(p->fpstate == FPactive){
  • FPactiveの場合は,プロセス状態に応じてfpsave()fpclear()を呼び,FPinactiveに遷移する.
  609:                 if(p->state == Moribund)
  610:                         fpclear();
  • FPactiveかつプロセス状態がMoribund(停止)状態の場合は,fpclear()を呼ぶ.
  • 詳細はfpclear()を参照
  611:                 else{
  612:                         /*
  613:                          * Fpsave() stores without handling pending
  614:                          * unmasked exeptions. Postnote() can't be called
  615:                          * here as sleep() already has up->rlock, so
  616:                          * the handling of pending exceptions is delayed
  617:                          * until the process runs again and generates an
  618:                          * emulation fault to activate the FPU.
  619:                          */
  620:                         fpsave(&p->fpsave);
  • FPactiveかつプロセス状態がMoribund(停止)状態でない場合は,FPUレジスタを保存する.
  • 詳細はfpsave()を参照
  621:                 }
  622:                 p->fpstate = FPinactive;
  623:         }
  624: 
  625:         /*
  626:          * While this processor is in the scheduler, the process could run
  627:          * on another processor and exit, returning the page tables to
  628:          * the free list where they could be reallocated and overwritten.
  629:          * When this processor eventually has to get an entry from the
  630:          * trashed page tables it will crash.
  631:          *
  632:          * If there's only one processor, this can't happen.
  633:          * You might think it would be a win not to do this in that case,
  634:          * especially on VMware, but it turns out not to matter.
  635:          */
  636:         mmuflushtlb(PADDR(m->pdb));
  637: }