Guest User

app.c

a guest
Apr 24th, 2023
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <sel4/sel4.h>
  2. #include <stdio.h>
  3.  
  4. #define CSPACE_DEPTH 32
  5. #define CDEPTH CSPACE_DEPTH
  6.  
  7. #define CSPACE (0x2) // bad guess work?
  8. #define RECV_CAP (0x3)
  9.  
  10. // seL4_SetCapReceivePath(REFOS_CSPACE, recv_cslot, REFOS_CSPACE_DEPTH)
  11.  
  12. seL4_CPtr parent_ep;
  13.  
  14. #define cnode 0
  15.  
  16. int main(int argc, char **argv) {
  17. printf("----------------------------------------------------------\n");
  18. printf("-- app started --\n");
  19. printf("----------------------------------------------------------\n");
  20. parent_ep = (seL4_CPtr)atol(argv[0]);
  21.  
  22. seL4_MessageInfo_t msg = seL4_MessageInfo_new(0, 0, 1, 0);
  23.  
  24. seL4_SetCapReceivePath(CSPACE, RECV_CAP, CDEPTH);
  25. seL4_MessageInfo_t ret = seL4_Call(parent_ep, msg);
  26. seL4_Uint64 extra_caps = seL4_MessageInfo_get_extraCaps(ret);
  27.  
  28. printf("app got reply: extraCaps=%d, r0=0x%x\n", extra_caps, seL4_GetMR(0));
  29.  
  30. seL4_CPtr ep = seL4_GetCap(0);
  31. printf("ep got cap: 0x%x\n", ep);
  32.  
  33. seL4_Word badge;
  34. msg = seL4_Recv(ep, &badge);
  35. printf("mesage from %d: 0x%x\n", badge, seL4_GetMR(0));
  36.  
  37. return 0;
  38. }
Add Comment
Please, Sign In to add comment