|
|
|
Re: Viewing page tables and some other questions regarding the MMU | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
|
> The MMU does not have to be disabled. To manage the page tables, the
> tables themselves must be mapped at some virtual address. In ARM
> Linux, this is already done, and you can access the page table entry
> for addr by doing something like this:
>
> pgd_t *pgd;
> pud_t *pud;
> pmd_t *pmd;
> pte_t *pte;
>
> pgd = pgd_offset(mm, addr);
> pud = pud_alloc(mm, pgd, addr);
> if (!pud) {
> printk(KERN_ERR "Could not alloc pud!\n");
> return NULL;
> }
> pmd = pmd_alloc(mm, pud, addr);
> if (!pmd) {
> printk(KERN_ERR "Could not alloc pmd!\n");
> return NULL;
> }
>
> pte = pte_alloc_map(mm, pmd, addr);
> if (!pte) {
> printk(KERN_ERR "Could not alloc pte!\n");
> return NULL;
> }
>
Thanks, this looks useful. Which headers does this code rely on? I
assume linux/mm.h, but anything else? Is the mm argument for the
functions used a global variable or something I have to create (and if
so, how to create it? the mm_struct is pretty damn large and filled
with fields that I know very little about)?
Best regards,
//Leo
_______________________________________________
linux-arm mailing list
linux-arm@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-arm
[Linux ARM] [Linux ARM MSM] [Linux ARM Kernel] [Fedora ARM] [IETF Annouce] [Security] [Bugtraq] [Linux] [Linux OMAP] [Linux MIPS] [ECOS] [Asterisk Internet PBX] [Linux API]
![]() |
![]() |