Guest User

Untitled

a guest
Nov 3rd, 2011
52
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
RAW Paste Data