Re: Why is a PA converted to a VA in pmd_page?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ed,

> For example, if the kernel tries to write through an invalid pointer,
> you get something predictable like an oops.  That's because the MMU
> catches the invalid address, even though the CPU is in superuser mode.
> Then do_page_fault runs and handles the kernel bug.

So the kernel uses paging too? What is the reason/benefit for doing so? Is
it so the kernel doesn't have to turn paging off and on when going back and
forth between kernel and user mode?

> I don't think you can do this:
>
>   *(__pa(p)) = 100;
>
> ... because (in lowmem x86), that __pa macro is going to subtract
> 0xc0000000 from the (virtual) address, meaning that it's now a
> userland address!

But the addresses from pgd_offset and pmd_offset don't call __va() before
returning the value, so that means what they return is a physical address,
right?

> It's not magic.  The translations for addresses greater than
> 0xC0000000 are in the TLB and the page tables just like the others.

Where is this set up? Is it in head.S?

Thanks,
Kirk
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux