]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/pmap_x86_common.c
xnu-1504.9.17.tar.gz
[apple/xnu.git] / osfmk / i386 / pmap_x86_common.c
index 53c1996e1eb227a6ec5e11305eb93cfd5c92bdbc..63ec071f42b1523728da73e6adb4afba82c0d652 100644 (file)
@@ -1112,6 +1112,8 @@ pmap_page_protect(
                                 * Fix up head later.
                                 */
                                pv_h->pmap = PMAP_NULL;
+
+                               pmap_phys_attributes[pai] &= ~PHYS_NOENCRYPT;
                        } else {
                                /*
                                 * Delete this entry.
@@ -1276,3 +1278,54 @@ mapping_adjust(void)
        mappingrecurse = 0;
 }
 
+
+boolean_t
+pmap_is_noencrypt(ppnum_t pn)
+{
+       int             pai;
+
+       pai = ppn_to_pai(pn);
+
+       if (!IS_MANAGED_PAGE(pai))
+               return (TRUE);
+
+       if (pmap_phys_attributes[pai] & PHYS_NOENCRYPT)
+               return (TRUE);
+
+       return (FALSE);
+}
+
+
+void
+pmap_set_noencrypt(ppnum_t pn)
+{
+       int             pai;
+
+       pai = ppn_to_pai(pn);
+
+       if (IS_MANAGED_PAGE(pai)) {
+               LOCK_PVH(pai);
+
+               pmap_phys_attributes[pai] |= PHYS_NOENCRYPT;
+
+               UNLOCK_PVH(pai);
+       }
+}
+
+
+void
+pmap_clear_noencrypt(ppnum_t pn)
+{
+       int             pai;
+
+       pai = ppn_to_pai(pn);
+
+       if (IS_MANAGED_PAGE(pai)) {
+               LOCK_PVH(pai);
+
+               pmap_phys_attributes[pai] &= ~PHYS_NOENCRYPT;
+
+               UNLOCK_PVH(pai);
+       }
+}
+