On 5/26/06, Bahadir Balban <bilgehan.balban@xxxxxxxxx> wrote:
Hi, As far as I know a page fault while in the kernel causes an error
Its not fully true. If the page fault occured while accessing the address in kernel address space (greater than 3G), then we error (OOPS). If we are in kernel mode, but accessing the address in user address space (less than 3G), we try to handle the page fault by looking into exception table of kernel. Exception table is a datastructure (can think of table), whose each entry hold tow elements, first element - the kernel address on which page fault can occur (these are virtual address of kernel instruction which normally access the data in user space, like instruction copping data from and to user space buffer), second element - its the kernel address of a instruction whihc need to be executed next when page fault occurs at the the address iven in first element; so second element is a pointer to the fix up code for fault occuring at address in first element. When we are in kernel mode and page fault occurs, If the eip (instruction on which page fault occured) address is found in found in exception table, eip is set to the fixup code address mentioned in the exception table and hence the the page fault is handled with out OOPS, but if faulting instruction's address is not found in exception table, OOPS is generated. All this was an explaination of when page fault occurs in kernel mode. and
all pages that are going to be accessed are mapped first. Is there a reason behind this? Whatif the kernel mapped perhaps some pages on demand upon a page fault? Is it not used because it is simpler not to, or is there a different reasoning behind it? Thanks, Bahadir -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/
-- Gaurav Email: gauravd.chd@xxxxxxxxx -------------------------------------------- Read my Linux Kernel blog at: http://lkdp.blogspot.com/ -------------------------------------------- -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/