Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 3rd, 2011  |  syntax: None  |  size: 0.59 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. bool copy_bootrom(void) {
  2.     const int size = 8*1024;
  3.     int i;
  4.     unsigned char buf[size];
  5.     int fd, w;
  6.     int old  = disable_irq_save();
  7.     cpucache_invalidate();
  8.     DEVID &= ~(1<<31);
  9.     SCU_REMAP = 0;
  10.     for (i = 0; i < size; i++) {
  11.       buf[i] = (*(volatile unsigned char*)(i));
  12.     }
  13.     SCU_REMAP = 0xDEADBEEF;
  14.     DEVID |= (1<<31);
  15.     restore_irq(old);
  16.     fd = creat("/bootrom.bin", 0666);
  17.     if (fd < 0) {
  18.       return false;
  19.     }
  20.     else {
  21.       w = write(fd, buf, size);
  22.       if (w < 0)
  23.         return false;
  24.       close(fd);
  25.     }
  26.      
  27.     return true;
  28. }
  29.  
clone this paste RAW Paste Data