LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-18-2007, 05:46 AM   #1
Kumar
Member
 
Registered: Sep 2003
Location: Pune, India
Distribution: Red Hat
Posts: 106

Rep: Reputation: 15
Modifying pagetable entries


Hi,
I am developing a chardriver which implements mmap using nopage method where I handle the pagefaults in that range. The problem is that the pagefault handler runs only once for any access in that page. My requirement is that, everytime the page is written, the handler should be invoked. So, I tried marking the page as read-only. But it's still not working. Following is the code snippet. Can anyone please tell me where am I going wrong? I am using kernel 2.6.19-1, gcc 3.4.6 on x86_64 architecture.

Code:
mmap_vma_nopage (struct vm_area_struct *vma, unsigned long address,
                  int write)
{
  ...

  pgd_t * pgd;
  pud_t * pud;
  pmd_t * pmd;
  pte_t * pte;

  pgd=pgd_offset(vma->vm_mm,address);
  pud=pud_offset(pgd,address);
  pmd=pmd_offset(pud,address);
  pte=pte_offset_map(pmd,address&PAGE_MASK);




  set_pte(pte,pte_wrprotect(*pte));
  set_pte(pte,pte_rdprotect(*pte));
  pte_unmap(pte);
  global_flush_tlb();

  ...

}


Thanks,

Last edited by Kumar; 01-18-2007 at 05:50 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Modifying a Distro rembot Linux - Newbie 2 06-20-2006 04:28 AM
Modifying Kweather zmaster Linux - Software 4 06-29-2005 12:40 PM
Help modifying FSTAB LinuxCrusader Linux - General 3 12-27-2004 01:26 AM
modifying .Xresources david_wliu Linux - General 3 03-18-2003 03:36 PM
Modifying menu entries X11 Linux - Software 0 04-26-2002 09:57 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration