Re: [PATCH v2 1/2] x86/boot/64: Make level2_kernel_pgt pages invalid outside kernel area.
From: Dave Hansen
Date: Tue Sep 24 2019 - 16:15:11 EST
On 9/24/19 1:04 PM, Steve Wahl wrote:
> Given that, would you feel better with A) the way I have it, B) your
> rewrite, or C) with an inline comment for each part of the loop:
>
> pmd = fixup_pointer(level2_kernel_pgt, physaddr);
>
> /* invalidate pages before the kernel image */
> for (i = 0; i < pmd_index((unsigned long)_text); i++)
> pmd[i] &= ~_PAGE_PRESENT;
>
> /* fixup pages that are part of the kernel image */
> for (; i <= pmd_index((unsigned long)_end); i++)
> if (pmd[i] & _PAGE_PRESENT)
> pmd[i] += load_delta;
>
> /* invalidate pages after the kernel image */
> for (; i < PTRS_PER_PMD; i++)
> pmd[i] &= ~_PAGE_PRESENT;
I don't feel super strongly either way, but I'd prefer doing B or C over
nothing.