On Sun, Nov 27, 2011 at 4:42 PM, Philip Guenther <guent...@gmail.com> wrote: > On Sun, Nov 27, 2011 at 9:19 AM, Luis Useche <use...@gmail.com> wrote: > ... >> The idea is to create this temporary mapping after we make sure the >> access was valid but the page was not in memory. > ... >> I am not proposing to trace the fault handler. My idea is to single >> step the last user-space instruction of the process in the fault >> handler to obtain the data that it was trying to write and return so >> the process can continue. >> >> Example: >> >> map_pte(cr2, tmp_page) >> single_step(cur) >> unmap_pte(cr2) > > I've read what you've read three times and I still don't understand > what problem you're trying to solve.
OK. I guess I'm not the best explaining, but the problem is simple. After the process is in the fault handler due to an access of a page not in memory, the current fault handler would map the page, return and the instruction that generated the fault re-executed. What I need is to keep control in kernel after re-executing the instruction. My idea was to single step by disassembling this instruction instead of returning to user space. In any case, I found a solution today. In x86 the TF flag repeat the current instruction and generates a debug trap that is caught by the kernel. This is how I get the control back after executing the instruction that generated the fault. I think I have the answer to my problem. I hope this fourth explanation makes sense. Luis.