refos_err_t srv_ctable_set_param_buffer_handler(srv_common_t *srv, struct srv_client *c, srv_msg_t *m, seL4_CPtr parambufferDataspace, uint32_t parambufferSize) { assert(srv && srv->magic == SRV_MAGIC); assert(c && m); /* Special case: unset the parameter buffer. */ if (!parambufferDataspace && parambufferSize == 0) { seL4_CNode_Revoke(REFOS_CSPACE, c->paramBuffer, REFOS_CDEPTH); seL4_CNode_Delete(REFOS_CSPACE, c->paramBuffer, REFOS_CDEPTH); csfree(c->paramBuffer); c->paramBuffer = 0; c->paramBufferSize = 0; return ESUCCESS; } /* Sanity check parameters. */ if (!srv_check_dispatch_caps(m, 0x00000000, 1)) { return EINVALIDPARAM; } if (parambufferSize == 0) { return EINVALIDPARAM; } /* Set the parameter buffer by copying out the given dspace cap. Do not printf before copyout. */ c->paramBuffer = rpc_copyout_cptr(parambufferDataspace); if (!c->paramBuffer) { ROS_ERROR("Failed to copyout the cap."); return ENOMEM; } c->paramBufferSize = parambufferSize; dprintf("Set param buffer for client cID = %d...\n", c->cID); return ESUCCESS; }
void reset_resources(void) { simple_t simple; camkes_make_simple(&simple); int i; seL4_CPtr root = simple_get_cnode(&simple); int error; /* revoke any of our initial untyped resources */ for (i = 0; i < simple_get_untyped_count(&simple); i++) { uint32_t size_bits; uint32_t paddr; seL4_CPtr ut = simple_get_nth_untyped(&simple, i, &size_bits, &paddr); error = seL4_CNode_Revoke(root, ut, 32); assert(error == seL4_NoError); } /* delete anything from any slots that should be empty */ for (i = simple_last_valid_cap(&simple) + 1; i < BIT(simple_get_cnode_size_bits(&simple)); i++) { error = seL4_CNode_Delete(root, i, 32); } /* save some pieces of the bss that we actually don't want to zero */ char save_sysinfo[4]; char save_libc[34]; char save_morecore_area[4]; char save_morecore_size[4]; memcpy(save_libc, __libc, 34); memcpy(save_sysinfo, __sysinfo, 4); memcpy(save_morecore_area, morecore_area, 4); memcpy(save_morecore_size, morecore_size, 4); /* zero the bss */ memset(__bss_start, 0, (uintptr_t)__bss_end - (uintptr_t)__bss_start); /* restore these pieces */ memcpy(__libc, save_libc, 34); memcpy(__sysinfo, save_sysinfo, 4); memcpy(morecore_area, save_morecore_area, 4); memcpy(morecore_size, save_morecore_size, 4); mutex_reinitializable_vm_lock_init(); }