I am trying some experiments involving the modification of the 
permissions on pages but I can't seem to get a valid pte in the first 
place. I wrote a little driver that has the following code in its init 
routine.

void init(){
  void * memory;
  pgd_t * pgd;
    pud_t * pud;
    pmd_t * pmd;
    pte_t * pte;

   memory = kmalloc(10, GFP_KERNEL);
  pgd = pgd_offset_k((unsigned long)memory);
    pud = pud_offset(pgd, (unsigned long) memory);
    pmd = pmd_offset(pud, (unsigned long) memory);
    pte = pte_offset_kernel(pmd, (unsigned long) memory);
    printk("pgd is %p\n", pgd);
    printk("pud is %p\n", pud);
    printk("pmd is %p\n", pmd);
    printk("pte is %p\n", pte);
    printk("memory is %p. page is %p\n", memory, pte_val(*pte));
}

And I see output like

pgd is 081fa584
pud is 081fa584
pmd is 081fa584
pte is 08048e8c
memory is 087a3750. page is 00000000

I tried this with an x86 build in VirtualBox with basically the same 
results, pte_val(*pte) was 0. Why is this?

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to