Implement protection changes on superpage mappings. Previously, a superpage mapping was unconditionally demoted by pmap_protect(), even if the protection change applied to the entire superpage mapping.
Precompute the bit mask describing the protection changes rather than recomputing it for every page table entry that is changed.
Skip page table entries that already have the requested protection changes in place.