Академический Документы
Профессиональный Документы
Культура Документы
do_page_fault first obtains the unaccessible address from the CPU control register. If the address is within the virtual address space of the process, the fault probably occurred, because the page was not swapped in, write protected or something similar. However, we are interested in the other case objdump --section-headers vmlinux objdump --disassemble --section=.text vmlinux objdump --disassemble --section=.fixup vmlinux objdump --full-contents --section=__ex_table vmlinu
The do_page_fault() function takes three parameters: A pointer to a pt_regs structure, which contains the values of microprocessor registers when the page fault occurred. An error code that indicates the reason for the page fault. The address that generated the page fault. The error code tells do_page_fault() if the process was reading from or writing to the associated address, and whether the page being accessed was actually in memory (vs. stored on disk) when the fault occurred. Do_page_fault() combines this with information in the processs mm_struct structure, to determine if the process has legitimate rights to access the memory address or not.
Registers are not belong to user mode(check the CPSR one) and not find the exception tabe Go to kernel fault (nohing but a die call ..that is oops)steps 2. Contnd in below. }
is pointed to the fixup code and then do_page_fault() returns thus jumping to the fixup code.
Do_page_faut(.)// contd
{ After steps 2 .
Fault=__do_page_fault() steps 3
find_vma()->check the fault address in residing on memory region or not . check the access error of the page , if it is fault then return as a VM_FAULT_BADACCESS call handle_mm_fault(..)
handle_mm_fault( ) function acts on four parameters: mm A pointer to the memory descriptor of the process that was running on the CPU when the exception occurred vma A pointer to the descriptor of the memory region, including the linear address that caused the exception address The linear address that caused the exception write_access Set to 1 if tsk attempted to write in address and to 0 if tsk attempted to read or execute it The handle_mm_fault( ) function returns 1 or 2 if it succeeded in allocating a new page frame for the process. The value 1 indicates that the Page Fault has been handled without blocking the current process; this kind of Page Fault is called minor fault. The value 2 indicates that the Page Fault forced the current process to sleep (most likely because time
was spent while filling the page frame assigned to the process with data read from disk); a Page Fault that blocks the current process is called a major fault
Do_page_faut(.)// contd
{ The return Fault value(it it wrong) will be compared with some SIGNAL(SIGBUS , SIGSEGV) and generate a correspoing task halt by that user task function }