Skip to content

Instantly share code, notes, and snippets.

/syscall.c Secret

Created September 27, 2015 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8294aa47ad351e4d4066 to your computer and use it in GitHub Desktop.
Save anonymous/8294aa47ad351e4d4066 to your computer and use it in GitHub Desktop.
Example syscall
seL4_MessageInfo_t syscall_create_ep(process* currproc) {
int err;
seL4_CPtr ep_cap;
seL4_Word ep_addr = ut_alloc(seL4_EndpointBits);
if (!ep_addr) {
printf("uh-oh 1\n");
return prepare_response(1, 0);
}
err = cspace_ut_retype_addr(ep_addr, seL4_EndpointObject,
seL4_EndpointBits, currproc->croot,
&ep_cap);
if (err) {
printf("uh-oh 2\n");
ut_free(ep_addr, seL4_EndpointBits);
return prepare_response(1, 0);
}
// TODO bookkeeping
return prepare_response(1, ep_cap);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment