Advertisement
sawyermade

Untitled

Apr 7th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. void trap (tf_t *tf)
  2. {
  3.     // TODO
  4.     uctx_pool[get_curid()] = *tf;
  5.     set_pdir_base(0);
  6.  
  7.     if(tf->trapno >= T_DIVIDE && tf->trapno <= T_SECEV)
  8.     {
  9.       exception_handler();
  10.     }
  11.  
  12.     else if(tf->trapno >= T_IRQ0 + IRQ_TIMER && tf->trapno <= T_IRQ0 + IRQ_IDE2)
  13.     {
  14.       interrupt_handler();
  15.     }
  16.     else if(tf->trapno == T_SYSCALL)
  17.     {
  18.       syscall_dispatch();
  19.     }
  20.       // Trap handled: call proc_start_user() to initiate return from trap.
  21.     proc_start_user ();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement