Advertisement
errypuu

main2.c

Dec 29th, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1. #define L4PANDA
  2. #define l4util_kip_for_each_feature(s)   for (s += strlen(s) + 1; *s; s += strlen(s) + 1)
  3.  
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <l4/util/reboot.h>
  7. #include <l4/util/kip.h>
  8. #include <l4/sys/ipc.h>
  9. #include <l4/sys/vhw.h>
  10. #include <l4/util/util.h>
  11. #include <l4/sys/mem_op.h>
  12. #include <l4/sys/factory.h>
  13. #include <l4/re/env.h>
  14. #include <unistd.h>
  15. #include <sys/time.h>
  16.  
  17. int main(void)
  18. {
  19.     l4_kernel_info_t *kip = l4re_kip();
  20.     struct l4_vhw_descriptor *vhw;
  21.     char cmd[12] ;
  22.     unsigned long readVal;
  23.     int i;
  24. //  L4::Factory* factory = L4Re::Env::env()->factory();
  25.     printf("Initialization Finished\n");
  26.     while(1)
  27.     {
  28.         printf("erry@erry-OS : \t");
  29.         fgets(cmd,sizeof(cmd),stdin);
  30.         printf("%s",cmd);
  31.         if(strcmp(cmd,"clear\n")==0)
  32.         {
  33.             int n;
  34.             for (n = 0; n < 10; n++)
  35.                 printf( "\n\n\n\n\n\n" );
  36.         }  
  37.         if(strcmp(cmd,"reboot\n")==0)
  38.         {
  39.             printf("Rebooting ...\t");
  40.             l4util_reboot();
  41.         }
  42.         if(strcmp(cmd,"kipinfo\n")==0)
  43.         {
  44.             if(!kip)
  45.                 printf("KIP not available!\n");
  46.             vhw = l4_vhw_get(kip);
  47.             printf("kip at %p, vhw at %p\n", kip, vhw);
  48.         //  print_entry(l4_vhw_get_entry(vhw, i));
  49.         }
  50.         if(strcmp(cmd,"testmem\n")==0)
  51.         {
  52.             readVal=l4_mem_read(0x4A31013C,L4_MEM_WIDTH_4BYTE);
  53.             printf("Sucessful Memory Read Value: 0x%x \t",readVal);
  54.             //l4util_reboot();
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement