You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

raw_loader.c 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2004 Tobias Lorenz
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifdef RAW_IMAGE
  9. static unsigned long raw_load_addr;
  10. int mach_boot(register unsigned long entry_point)
  11. {
  12. void (*fnc)(void) = (void *) entry_point;
  13. // r0 = 0
  14. // r1 = 625 (machine nr. MACH_TYPE_P2001)
  15. (*fnc)();
  16. return 0; /* We should never reach this point ! */
  17. }
  18. static sector_t raw_download(unsigned char *data, unsigned int len, int eof)
  19. {
  20. memcpy(phys_to_virt(raw_load_addr), data, len);
  21. raw_load_addr += len;
  22. if (!eof)
  23. return 0;
  24. done(1);
  25. printf("Starting program.\n");
  26. mach_boot(RAWADDR);
  27. printf("Bootsector returned?");
  28. longjmp(restart_etherboot, -2);
  29. return 1;
  30. }
  31. static os_download_t raw_probe(unsigned char *data __unused, unsigned int len __unused)
  32. {
  33. printf("(RAW");
  34. // probe something here...
  35. printf(")... \n");
  36. //raw_load_addr = phys_to_virt(_end);
  37. raw_load_addr = RAWADDR;
  38. printf("Writing image to 0x%x\n", raw_load_addr);
  39. return raw_download;
  40. }
  41. #endif