previous | start | next

Extra Entries in Kernel's Process Table

The proc table's first entry is a place to save the registers of an interrupted process:

struct proc {
  struct stackframe_s p_reg;/* process' registers saved in stack frame
  */
  ....
} proc[NR_TASKS + NR_PROCS];

When a hardware interrupt occurs or a trap instruction is executed the registers for the RUNNING process are saved in this member of the process's proc table entry.

Conversely, when a process becomes scheduled and is dispatched, the the values from this entry are reloaded into the cpu registers.



previous | start | next