Processing on IA32 Systems

IA-32 requires slightly more work in do_IRQ, as the code flow diagram in Figure 14-10 shows. We first suppose that a single page frame is used for the kernel stack, that is, 4 KiB are available per process for the kernel. This is configured if config_4kstacks is set. Recall that in this case a separate stack is used to handle IRQ processing.

Figure 14-10: Code flow diagram for do_iRQ on IA-32 systems.

As in the AMD64 case, the functions set_irq_regs and irq_enter are called with the same purpose as before. The kernel must switch to the IRQ stack. The current stack can be obtained by calling the auxiliary function current_thread_info, which delivers a pointer to the thread_info instance currently in use. Recall from above that this information is in a union with the current stack. A pointer to the appropriate IRQ-stack can be obtained from hardirq_ctx as discussed above.

Two cases are possible:

1. The process is already using the IRQ stack because nested IRQs are processed. In this case, the kernel can be lazy — nothing needs to be done because everything is already set up. irq_desc[irq]->handle_irq can be called to activate the ISR stored in the IRQ database.

2. The current stack is not the IRQ stack (curctx != irqctx), and a switch between both is required. In this case, the kernel performs the required low-level assembler operations to switch between the stacks, calls irq_desc[irq]->handle_irq, and switches the stacks back.

Note that in both cases the ISR is called directly and not via a detour over generic_handle_irq as on AMD64 systems.

The remaining work is done in the same way as on AMD64 systems. irq_exit handles some accounting and activates SoftIRQs, and set_irq_regs restores the register pointer to the state before the IRQ happened.

When stacks with 8-KiB size, that is, two page frames, are used, IRQ handling is simplified because a potential stack switch does not need to be taken into account and irq_desc[irq]->handle_irq can be called immediately in any case.

Continue reading here: Old Style Processing

Was this article helpful?

0 0