As noted in LDD the kernel virtual memory (top 1GB in IA-32 address space) is partitioned into kernel logical addresses and kernel virtual addresses. Kernel logical addresses are mapped directly which means that you can map virtual addresses to physical addresses by subtracting a certain (0xC0000000) value. For moving btwn mappings a pair of macros are defined: __pa()
and __va()
.
My questions are: "What are the usecases for these macros?" and: "What is the benefit of direct mapping?"
I have heared that direct mapping allows using larger pages (e.g., 4MB) and consequently leads to more efficient translation. Are translations for the directly mapped region performed using page tables?