/* * This must happen _after_ the memory is mapped in so that the * ucap_tbl can be found in the spd */ static int boot_spd_caps(struct cobj_header *h, spdid_t spdid) { struct cobj_cap *cap; unsigned int i; for (i = 0 ; i < h->ncap ; i++) { cap = cobj_cap_get(h, i); if (cobj_cap_undef(cap)) break; /* we have a fault handler... */ if (cap->fault_num < COS_NUM_FAULTS) { if (cos_cap_cntl(COS_CAP_SET_FAULT, spdid, cap->cap_off, cap->fault_num)) BUG(); } if (cos_cap_cntl(COS_CAP_SET_SERV_FN, spdid, cap->cap_off, cap->sfn) || cos_cap_cntl(COS_CAP_SET_CSTUB, spdid, cap->cap_off, cap->cstub) || cos_cap_cntl(COS_CAP_SET_SSTUB, spdid, cap->cap_off, cap->sstub) || cos_cap_cntl(COS_CAP_ACTIVATE, spdid, cap->cap_off, cap->dest_id)) BUG(); boot_edge_create(spdid, cap->dest_id); } return 0; }
static int cap_to_dest(int cap) { int dest = 0; assert(cap > MAX_NUM_SPDS); if ((dest = cos_cap_cntl(COS_CAP_GET_SER_SPD, 0, 0, cap)) <= 0) assert(0); return dest; }
/* Deactivate or activate all capabilities to an spd (i.e. call faults * on invocation, or use normal stubs) */ static int boot_spd_caps_chg_activation(spdid_t spdid, int activate) { int i; /* Find all capabilities to spdid */ for (i = 0 ; hs[i] != NULL ; i++) { unsigned int j; if (hs[i]->id == spdid) continue; for (j = 0 ; j < hs[i]->ncap ; j++) { struct cobj_cap *cap; cap = cobj_cap_get(hs[i], j); if (cobj_cap_undef(cap)) break; if (cap->dest_id != spdid) continue; cos_cap_cntl(COS_CAP_SET_SSTUB, hs[i]->id, cap->cap_off, activate ? cap->sstub : 1); } } return 0; }