Info

struct exception_table_entry {

unsigned long insn, fixup;

insn specifies the position in virtual address space at which the kernel expects the fault; fixup is the code address at which execution resumes when the fault occurs.

fixup_exception is used to search the exception tables and is defined as follows on IA-32 systems: arch/x86/mm/extable_32.c int fixup_exception(struct pt_regs *regs) {

const struct exception_table_entry *fixup;

fixup = search_exception_tables(regs->eip); if (fixup) {

return 0;

regs->eip points to the eip register that, on IA-32 processors, contains the address of the code segment where the fault was triggered. search_exception_tables scans the exception table for a suitable entry.21

21 To be more accurate, several tables are scanned — the main kernel table and the tables registered by modules loaded dynamically at kernel run time. As the mechanisms used are practically the same, it's not worth describing their minor differences.

When a fixup routine is found, the instruction pointer is set to the corresponding memory location. The kernel executes the routine found after fixup_exception returns with return.

What happens if there is no fixup routine? This indicates a genuine kernel fault that is handled by the code in do_page_fault, which follows the (unsuccessful) call of search_exception_table and results in a kernel oops. It looks like this on IA-32 processors:

Continue reading here: Archx86mmfault32c

Was this article helpful?

0 0