I have a problem handling Page Fault that is raised by a user process (ring 3).
PS: Paltform: Intel 0x386, Using hardware supported Task switch, Segmentation and Paging
Currently, this is what the infrastructure I have for Page Fault:-
when a user process accesses a mem area which is not present, then it page faults. I have loaded the IDT for Page Fault Exception 0xE with an Interrupt Task Gate. So, the page fault trigerrs a TSS switch which executes the page fault handler in ring 0 (kernel mode). allocates the page and returns back (TSS switch back) to user process (ring 3). So far so good, it worked fine.
But now if Page allocation fails due to some reason, then I need to stop/kill that process. How to do this? The Kernel (which includes scheduler) is a Seperate TSS, Page Fault Handler is a seperate TSS and user process is a seperate TSS. How to swtich back to kernel TSS w/o executing any further instructions of user process and kill it??
I tried using a normal exception handler and also interrupt gate for page fault handler -> then switched to actual page allocation routine through a TSS switch manually and communicated the success/failure status via shared memory back to page fault exception handler. But no luck as I get General Protection Fault when I finally do a IRET from exception handler!!
Can anyone please advise.
Thanks,
- MosMan

