Just found something from the Intel manual which i would like to share, to refine my answer further. On Nov 17, 2007 12:56 PM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote: > On Nov 17, 2007 6:44 AM, Vegard Nossum <vegard.nossum@xxxxxxxxx> wrote: > > Hi, > > > > I have these questions regarding page faults and interrupts on the 386. > > > > Can page faults happen while a CPU is executing an interrupt handler? > > Yes. One CPU can be executing the interrupt handler, and page faults > happening on another CPU. Modern dual-core made this scenario not > impossible. Even if the interrupt is disable on the CPU handling the > interrupt handler, it is only confined to that CPU, not the rest. > > > As far as I know, interrupt handlers are entered with interrupts > > disabled. Does this mask page faults? > > Yes, page faults is masked out with interrupt disabling, as it is not a NMI. The anser is WRONG - correct answer is: Yes, page faults is automatically disabled, by virtue of the fact u are in interrupt handler, with or without interrupt disabled (meaning CLI is called or not). The following is taken verbatim from the Intel manual (3a): "When an interrupt is handled through an interrupt gate, the IF flag is automati- cally cleared, which disables maskable hardware interrupts. (If an interrupt is handled through a trap gate, the IF flag is not cleared.)" Notice the word "automatically" here - hardware-wise, not under software control. So when u enter the interrupt, the entire range of 0-31 interrupts is automatically disabled (and page fault falled under vector 0x14), but not the 32-255 user-defined interrupt vector. So linux have to explicitly disable the interrupt for these - which is your normal "disable the interrupt when entering interrupt handler", or CLI. But when u are NOT in interrupt handler, u can disable any of the handler for 0-31 interrupt vector, through the use of interrupt flag (pushf/popf pair) - inclusive of pagefault itself - individually. So it is possible NOT to disable pagefault when CLI is in operation (ie, all interrupt is disabled, except for pagefault), but this must happened when u are NOT inside the interrupt handler. > > If so, what happens when the > > kernel faults on swapped-out pages within interrupts? > > Basically OS crashes, if the interrupt is disabled at that moment > attempt to access memory contents which is not there. > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ