T187: Add Mapping cap types
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Tue, 17 Nov 2015 15:30:52 +0000 (16:30 +0100)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Tue, 17 Nov 2015 15:30:52 +0000 (16:30 +0100)
Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

capabilities/caps.hl
errors/errno.fugu
include/barrelfish_kpi/capabilities.h
include/barrelfish_kpi/distcaps.h
kernel/capabilities.c
kernel/include/capabilities.h

index 53e6ec8..d9ef938 100644 (file)
@@ -158,6 +158,14 @@ cap Frame from RAM from_self {
     size_bits uint8 bits;      /* Address bits this frame bears */
 };
 
+cap Frame_Mapping from Frame {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 cap DevFrame from PhysAddr from_self {
     /* Mappable device frame */
 
@@ -165,6 +173,13 @@ cap DevFrame from PhysAddr from_self {
     size_bits uint8 bits;      /* Address bits this frame bears */
 };
 
+cap DevFrame_Mapping from DevFrame {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
 
 cap Kernel is_always_copy {
     /* Capability to a kernel */
@@ -181,6 +196,15 @@ cap VNode_x86_64_pml4 from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_x86_64_pml4_Mapping from VNode_x86_64_pml4 {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
+
 cap VNode_x86_64_pdpt from RAM {
     /* PDPT */
 
@@ -188,6 +212,14 @@ cap VNode_x86_64_pdpt from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_x86_64_pdpt_Mapping from VNode_x86_64_pdpt {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 cap VNode_x86_64_pdir from RAM {
     /* Page directory */
 
@@ -195,6 +227,14 @@ cap VNode_x86_64_pdir from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_x86_64_pdir_Mapping from VNode_x86_64_pdir {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 cap VNode_x86_64_ptable from RAM {
     /* Page table */
 
@@ -202,6 +242,14 @@ cap VNode_x86_64_ptable from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_x86_64_ptable_Mapping from VNode_x86_64_ptable {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 
 /* x86_32-specific capabilities: */
 
@@ -212,6 +260,14 @@ cap VNode_x86_32_pdpt from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_x86_32_pdpt_Mapping from VNode_x86_32_pdpt {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 cap VNode_x86_32_pdir from RAM {
     /* Page directory */
 
@@ -219,6 +275,14 @@ cap VNode_x86_32_pdir from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_x86_32_pdir_Mapping from VNode_x86_32_pdir {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 cap VNode_x86_32_ptable from RAM {
     /* Page table */
 
@@ -226,6 +290,14 @@ cap VNode_x86_32_ptable from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_x86_32_ptable_Mapping from VNode_x86_32_ptable {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 /* ARM specific capabilities: */
 
 cap VNode_ARM_l1 from RAM {
@@ -235,12 +307,28 @@ cap VNode_ARM_l1 from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_ARM_l1_Mapping from VNode_ARM_l1 {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 cap VNode_ARM_l2 from RAM {
     /* L2 Page Table */
     address genpaddr base;  /* Base address of VNode */
     size_bits { vnode_size };
 };
 
+cap VNode_ARM_l2_Mapping from VNode_ARM_l2 {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 /* ARM AArch64-specific capabilities: */
 
 cap VNode_AARCH64_l1 from RAM {
@@ -249,18 +337,41 @@ cap VNode_AARCH64_l1 from RAM {
     size_bits { vnode_size };
 };
 
+cap VNode_AARCH64_l1_Mapping from VNode_AARCH64_l1 {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 cap VNode_AARCH64_l2 from RAM {
     /* L2 Page Table */
     address genpaddr base;  /* Base address of VNode */
     size_bits { vnode_size };
 };
 
+cap VNode_AARCH64_l2_Mapping from VNode_AARCH64_l2 {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
+
 cap VNode_AARCH64_l3 from RAM {
     /* L3 Page Table */
     address genpaddr base;  /* Base address of VNode */
     size_bits { vnode_size };
 };
 
+cap VNode_AARCH64_l3_Mapping from VNode_AARCH64_l3 {
+    "struct capability" frame;
+    eq lvaddr pte;
+    uint16 pte_count;
+
+    address { get_address(frame) };
+};
 
 /** IRQTable and IO are slightly different **/
 
index e25a5cc..b79d014 100755 (executable)
@@ -58,6 +58,7 @@ errors kernel SYS_ERR_ {
     failure ROOT_CAP_LOOKUP     "Error looking up root capability",
     failure DEST_TYPE_INVALID   "Destination capability is of invalid type",
     failure INVALID_RETYPE      "Invalid source/destination type pair for retyping",
+    failure RETYPE_MAPPING_EXPLICIT "Invalid explicit retype to mapping type",
     failure REVOKE_FIRST        "Capability already has descendants or siblings",
     failure INVALID_SIZE_BITS   "Invalid size for new objects",
     failure SLOTS_INVALID       "Destination capability slots exceed capacity of CNode",
index 21034b7..d975995 100644 (file)
@@ -55,7 +55,7 @@ struct dcb;
 
 static inline bool type_is_vnode(enum objtype type)
 {
-    STATIC_ASSERT(30 == ObjType_Num, "Check VNode definitions");
+    STATIC_ASSERT(44 == ObjType_Num, "Check VNode definitions");
 
     return (type == ObjType_VNode_x86_64_pml4 ||
             type == ObjType_VNode_x86_64_pdpt ||
@@ -82,7 +82,7 @@ static inline bool type_is_vnode(enum objtype type)
 static inline size_t vnode_objbits(enum objtype type)
 {
     // This function should be emitted by hamlet or somesuch.
-    STATIC_ASSERT(30 == ObjType_Num, "Check VNode definitions");
+    STATIC_ASSERT(44 == ObjType_Num, "Check VNode definitions");
 
     if (type == ObjType_VNode_x86_64_pml4 ||
         type == ObjType_VNode_x86_64_pdpt ||
@@ -120,7 +120,7 @@ static inline size_t vnode_objbits(enum objtype type)
  */
 static inline size_t vnode_entry_bits(enum objtype type) {
     // This function should be emitted by hamlet or somesuch.
-    STATIC_ASSERT(30 == ObjType_Num, "Check VNode definitions");
+    STATIC_ASSERT(44 == ObjType_Num, "Check VNode definitions");
 
     if (type == ObjType_VNode_x86_64_pml4 ||
         type == ObjType_VNode_x86_64_pdpt ||
@@ -171,6 +171,71 @@ static inline size_t vnode_entry_bits(enum objtype type) {
     return 0;
 }
 
+static inline enum objtype get_mapping_type(enum objtype captype)
+{
+    STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all mapping types");
+
+    switch (captype) {
+        case ObjType_Frame:
+            return ObjType_Frame_Mapping;
+        case ObjType_DevFrame:
+            return ObjType_DevFrame_Mapping;
+        case ObjType_VNode_x86_64_pml4:
+            return ObjType_VNode_x86_64_pml4_Mapping;
+        case ObjType_VNode_x86_64_pdpt:
+            return ObjType_VNode_x86_64_pdpt_Mapping;
+        case ObjType_VNode_x86_64_pdir:
+            return ObjType_VNode_x86_64_pdir_Mapping;
+        case ObjType_VNode_x86_64_ptable:
+            return ObjType_VNode_x86_64_ptable_Mapping;
+        case ObjType_VNode_x86_32_pdpt:
+            return ObjType_VNode_x86_32_pdpt_Mapping;
+        case ObjType_VNode_x86_32_pdir:
+            return ObjType_VNode_x86_32_pdir_Mapping;
+        case ObjType_VNode_x86_32_ptable:
+            return ObjType_VNode_x86_32_ptable_Mapping;
+        case ObjType_VNode_ARM_l1:
+            return ObjType_VNode_ARM_l1_Mapping;
+        case ObjType_VNode_ARM_l2:
+            return ObjType_VNode_ARM_l2_Mapping;
+        case ObjType_VNode_AARCH64_l1:
+            return ObjType_VNode_AARCH64_l1_Mapping;
+        case ObjType_VNode_AARCH64_l2:
+            return ObjType_VNode_AARCH64_l2_Mapping;
+        case ObjType_VNode_AARCH64_l3:
+            return ObjType_VNode_AARCH64_l3_Mapping;
+        /* all other types are not mappable */
+        default:
+            return ObjType_Null;
+    }
+}
+
+static inline bool type_is_mapping(enum objtype type)
+{
+    STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all mapping types");
+
+    switch (type) {
+        case ObjType_Frame_Mapping:
+        case ObjType_DevFrame_Mapping:
+        case ObjType_VNode_x86_64_pml4_Mapping:
+        case ObjType_VNode_x86_64_pdpt_Mapping:
+        case ObjType_VNode_x86_64_pdir_Mapping:
+        case ObjType_VNode_x86_64_ptable_Mapping:
+        case ObjType_VNode_x86_32_pdpt_Mapping:
+        case ObjType_VNode_x86_32_pdir_Mapping:
+        case ObjType_VNode_x86_32_ptable_Mapping:
+        case ObjType_VNode_ARM_l1_Mapping:
+        case ObjType_VNode_ARM_l2_Mapping:
+        case ObjType_VNode_AARCH64_l1_Mapping:
+        case ObjType_VNode_AARCH64_l2_Mapping:
+        case ObjType_VNode_AARCH64_l3_Mapping:
+            return true;
+
+        /* all other types are not mapping types */
+        default:
+            return false;
+    }
+}
 
 /**
  * CNode capability commands.
index 67d5534..356ebb8 100644 (file)
@@ -40,7 +40,7 @@ distcap_state_is_foreign(distcap_state_t state)
  * Predicates related to sharing capabilities
  */
 
-STATIC_ASSERT(ObjType_Num == 30, "Knowledge of all cap types");
+STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all cap types");
 static inline bool
 distcap_needs_locality(enum objtype type)
 {
@@ -65,6 +65,20 @@ distcap_needs_locality(enum objtype type)
     case ObjType_VNode_AARCH64_l1:
     case ObjType_VNode_AARCH64_l2:
     case ObjType_VNode_AARCH64_l3:
+    case ObjType_VNode_ARM_l1_Mapping:
+    case ObjType_VNode_ARM_l2_Mapping:
+    case ObjType_VNode_AARCH64_l1_Mapping:
+    case ObjType_VNode_AARCH64_l2_Mapping:
+    case ObjType_VNode_AARCH64_l3_Mapping:
+    case ObjType_VNode_x86_64_pml4_Mapping:
+    case ObjType_VNode_x86_64_pdpt_Mapping:
+    case ObjType_VNode_x86_64_pdir_Mapping:
+    case ObjType_VNode_x86_64_ptable_Mapping:
+    case ObjType_VNode_x86_32_pdpt_Mapping:
+    case ObjType_VNode_x86_32_pdir_Mapping:
+    case ObjType_VNode_x86_32_ptable_Mapping:
+    case ObjType_DevFrame_Mapping:
+    case ObjType_Frame_Mapping:
     // XXX: KCB should need locality?
     //case ObjType_KernelControlBlock:
         return true;
@@ -73,7 +87,7 @@ distcap_needs_locality(enum objtype type)
     }
 }
 
-STATIC_ASSERT(ObjType_Num == 30, "Knowledge of all cap types");
+STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all cap types");
 static inline bool
 distcap_is_moveable(enum objtype type)
 {
index d95b509..8e493c1 100644 (file)
@@ -52,6 +52,7 @@ void caps_trace_ctrl(uintptr_t types, genpaddr_t start, gensize_t size)
 
 struct capability monitor_ep;
 
+STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all cap types");
 int sprint_cap(char *buf, size_t len, struct capability *cap)
 {
     switch (cap->type) {
@@ -134,6 +135,104 @@ int sprint_cap(char *buf, size_t len, struct capability *cap)
         return snprintf(buf, len, "x86_64 PML4 at 0x%" PRIxGENPADDR,
                         cap->u.vnode_x86_64_pml4.base);
 
+    case ObjType_Frame_Mapping:
+        return snprintf(buf, len, "Frame Mapping (Frame cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.frame_mapping.frame,
+                                  cap->u.frame_mapping.pte,
+                                  cap->u.frame_mapping.pte_count);
+
+    case ObjType_DevFrame_Mapping:
+        return snprintf(buf, len, "DevFrame Mapping (DevFrame cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.devframe_mapping.frame,
+                                  cap->u.devframe_mapping.pte,
+                                  cap->u.devframe_mapping.pte_count);
+
+    case ObjType_VNode_x86_64_pml4_Mapping:
+        return snprintf(buf, len, "x86_64 PML4 Mapping (x86_64 PML4 cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_x86_64_pml4_mapping.frame,
+                                  cap->u.vnode_x86_64_pml4_mapping.pte,
+                                  cap->u.vnode_x86_64_pml4_mapping.pte_count);
+
+    case ObjType_VNode_x86_64_pdpt_Mapping:
+        return snprintf(buf, len, "x86_64 PDPT Mapping (x86_64 PDPT cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_x86_64_pdpt_mapping.frame,
+                                  cap->u.vnode_x86_64_pdpt_mapping.pte,
+                                  cap->u.vnode_x86_64_pdpt_mapping.pte_count);
+
+    case ObjType_VNode_x86_64_pdir_Mapping:
+        return snprintf(buf, len, "x86_64 PDIR Mapping (x86_64 PDIR cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_x86_64_pdir_mapping.frame,
+                                  cap->u.vnode_x86_64_pdir_mapping.pte,
+                                  cap->u.vnode_x86_64_pdir_mapping.pte_count);
+
+    case ObjType_VNode_x86_64_ptable_Mapping:
+        return snprintf(buf, len, "x86_64 PTABLE Mapping (x86_64 PTABLE cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_x86_64_ptable_mapping.frame,
+                                  cap->u.vnode_x86_64_ptable_mapping.pte,
+                                  cap->u.vnode_x86_64_ptable_mapping.pte_count);
+
+    case ObjType_VNode_x86_32_pdpt_Mapping:
+        return snprintf(buf, len, "x86_32 PDPT Mapping (x86_32 PDPT cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_x86_32_pdpt_mapping.frame,
+                                  cap->u.vnode_x86_32_pdpt_mapping.pte,
+                                  cap->u.vnode_x86_32_pdpt_mapping.pte_count);
+
+    case ObjType_VNode_x86_32_pdir_Mapping:
+        return snprintf(buf, len, "x86_32 PDIR Mapping (x86_32 PDIR cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_x86_32_pdir_mapping.frame,
+                                  cap->u.vnode_x86_32_pdir_mapping.pte,
+                                  cap->u.vnode_x86_32_pdir_mapping.pte_count);
+
+    case ObjType_VNode_x86_32_ptable_Mapping:
+        return snprintf(buf, len, "x86_32 PTABLE Mapping (x86_32 PTABLE cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_x86_32_ptable_mapping.frame,
+                                  cap->u.vnode_x86_32_ptable_mapping.pte,
+                                  cap->u.vnode_x86_32_ptable_mapping.pte_count);
+
+    case ObjType_VNode_ARM_l1_Mapping:
+        return snprintf(buf, len, "ARM l1 Mapping (ARM l1 cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_arm_l1_mapping.frame,
+                                  cap->u.vnode_arm_l1_mapping.pte,
+                                  cap->u.vnode_arm_l1_mapping.pte_count);
+
+    case ObjType_VNode_ARM_l2_Mapping:
+        return snprintf(buf, len, "ARM l2 Mapping (ARM l2 cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_arm_l2_mapping.frame,
+                                  cap->u.vnode_arm_l2_mapping.pte,
+                                  cap->u.vnode_arm_l2_mapping.pte_count);
+
+    case ObjType_VNode_AARCH64_l1_Mapping:
+        return snprintf(buf, len, "AARCH64 l1 Mapping (AARCH64 l1 cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_aarch64_l1_mapping.frame,
+                                  cap->u.vnode_aarch64_l1_mapping.pte,
+                                  cap->u.vnode_aarch64_l1_mapping.pte_count);
+
+    case ObjType_VNode_AARCH64_l2_Mapping:
+        return snprintf(buf, len, "AARCH64 l2 Mapping (AARCH64 l2 cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_aarch64_l2_mapping.frame,
+                                  cap->u.vnode_aarch64_l2_mapping.pte,
+                                  cap->u.vnode_aarch64_l2_mapping.pte_count);
+
+    case ObjType_VNode_AARCH64_l3_Mapping:
+        return snprintf(buf, len, "AARCH64 l3 Mapping (AARCH64 l3 cap @0x%p, "
+                                  "pte @0x%"PRIxLVADDR", pte_count=%hu)",
+                                  cap->u.vnode_aarch64_l3_mapping.frame,
+                                  cap->u.vnode_aarch64_l3_mapping.pte,
+                                  cap->u.vnode_aarch64_l3_mapping.pte_count);
+
     case ObjType_IRQTable:
         return snprintf(buf, len, "IRQTable cap");
 
@@ -230,7 +329,7 @@ static errval_t set_cap(struct capability *dest, struct capability *src)
 
 // If you create more capability types you need to deal with them
 // in the table below.
-STATIC_ASSERT(30 == ObjType_Num, "Knowledge of all cap types");
+STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all cap types");
 
 static size_t caps_numobjs(enum objtype type, uint8_t bits, uint8_t objbits)
 {
@@ -296,6 +395,20 @@ static size_t caps_numobjs(enum objtype type, uint8_t bits, uint8_t objbits)
     case ObjType_Notify_IPI:
     case ObjType_PerfMon:
     case ObjType_IPI:
+    case ObjType_VNode_ARM_l1_Mapping:
+    case ObjType_VNode_ARM_l2_Mapping:
+    case ObjType_VNode_AARCH64_l1_Mapping:
+    case ObjType_VNode_AARCH64_l2_Mapping:
+    case ObjType_VNode_AARCH64_l3_Mapping:
+    case ObjType_VNode_x86_64_pml4_Mapping:
+    case ObjType_VNode_x86_64_pdpt_Mapping:
+    case ObjType_VNode_x86_64_pdir_Mapping:
+    case ObjType_VNode_x86_64_ptable_Mapping:
+    case ObjType_VNode_x86_32_pdpt_Mapping:
+    case ObjType_VNode_x86_32_pdir_Mapping:
+    case ObjType_VNode_x86_32_ptable_Mapping:
+    case ObjType_DevFrame_Mapping:
+    case ObjType_Frame_Mapping:
         return 1;
 
     default:
@@ -309,7 +422,7 @@ static size_t caps_numobjs(enum objtype type, uint8_t bits, uint8_t objbits)
  *
  * For the meaning of the parameters, see the 'caps_create' function.
  */
-STATIC_ASSERT(ObjType_Num == 30, "Knowledge of all cap types");
+STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all cap types");
 
 static errval_t caps_init_objects(enum objtype type, lpaddr_t lpaddr, uint8_t
                                   bits, uint8_t objbits, size_t numobjs)
@@ -389,7 +502,7 @@ static errval_t caps_init_objects(enum objtype type, lpaddr_t lpaddr, uint8_t
  */
 // If you create more capability types you need to deal with them
 // in the table below.
-STATIC_ASSERT(30 == ObjType_Num, "Knowledge of all cap types");
+STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all cap types");
 
 static errval_t caps_create(enum objtype type, lpaddr_t lpaddr, uint8_t bits,
                             uint8_t objbits, size_t numobjs, coreid_t owner,
@@ -402,6 +515,7 @@ static errval_t caps_create(enum objtype type, lpaddr_t lpaddr, uint8_t bits,
     assert(type != ObjType_Null);
     assert(type < ObjType_Num);
     assert(numobjs > 0);
+    assert(!type_is_mapping(type));
 
     genpaddr_t genpaddr = local_phys_to_gen_phys(lpaddr);
 
@@ -1154,6 +1268,7 @@ errval_t caps_create_new(enum objtype type, lpaddr_t addr, size_t bits,
 }
 
 
+STATIC_ASSERT(44 == ObjType_Num, "Knowledge of all cap types");
 /// Retype caps
 errval_t caps_retype(enum objtype type, size_t objbits,
                      struct capability *dest_cnode, cslot_t dest_slot,
@@ -1173,6 +1288,11 @@ errval_t caps_retype(enum objtype type, size_t objbits,
 
     TRACE_CAP_MSG("retyping", src_cte);
 
+    /* No explicit retypes to Mapping allowed */
+    if (type_is_mapping(type)) {
+        return SYS_ERR_RETYPE_MAPPING_EXPLICIT;
+    }
+
     /* Check retypability */
     err = is_retypeable(src_cte, src_cap->type, type, from_monitor);
     if (err_is_fail(err)) {
index 6e049d9..0de7a45 100644 (file)
@@ -124,7 +124,23 @@ errval_t caps_revoke(struct cte *cte);
  * Cap tracing
  */
 #ifdef TRACE_PMEM_CAPS
-STATIC_ASSERT(ObjType_Num == 30, "knowledge of all cap types");
+STATIC_ASSERT(44 == ObjType_Num, "knowledge of all cap types");
+#define MAPPING_TYPES \
+    ((1ul<<ObjType_VNode_x86_64_pml4_Mapping) | \
+     (1ul<<ObjType_VNode_x86_64_pdpt_Mapping) | \
+     (1ul<<ObjType_VNode_x86_64_pdir_Mapping) | \
+     (1ul<<ObjType_VNode_x86_64_ptable_Mapping) | \
+     (1ul<<ObjType_VNode_x86_32_pdpt_Mapping) | \
+     (1ul<<ObjType_VNode_x86_32_pdir_Mapping) | \
+     (1ul<<ObjType_VNode_x86_32_ptable_Mapping) | \
+     (1ul<<ObjType_VNode_ARM_l1_Mapping) | \
+     (1ul<<ObjType_VNode_ARM_l2_Mapping) | \
+     (1ul<<ObjType_VNode_AARCH64_l1_Mapping) | \
+     (1ul<<ObjType_VNode_AARCH64_l2_Mapping) | \
+     (1ul<<ObjType_VNode_AARCH64_l3_Mapping) | \
+     (1ul<<ObjType_Frame_Mapping) | \
+     (1ul<<ObjType_DevFrame_Mapping))
+
 #define ALL_PMEM_TYPES \
     ((1ul<<ObjType_RAM) | \
      (1ul<<ObjType_Frame) | \
@@ -144,7 +160,8 @@ STATIC_ASSERT(ObjType_Num == 30, "knowledge of all cap types");
      (1ul<<ObjType_VNode_AARCH64_l2) | \
      (1ul<<ObjType_VNode_AARCH64_l3) | \
      (1ul<<ObjType_PhysAddr) | \
-     (1ul<<ObjType_KernelControlBlock))
+     (1ul<<ObjType_KernelControlBlock) | \
+     MAPPING_TYPES)
 
 #define TRACE_TYPES_ENABLED_INITIAL 0x0
 #define TRACE_PMEM_BEGIN_INITIAL    0x0