init.c 995 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include <grub/kernel.h>
  2. #include <grub/misc.h>
  3. #include <grub/env.h>
  4. #include <grub/time.h>
  5. #include <grub/types.h>
  6. #include <grub/misc.h>
  7. #include <grub/mm.h>
  8. #include <grub/time.h>
  9. #include <grub/machine/kernel.h>
  10. #include <grub/machine/memory.h>
  11. #include <grub/cpu/kernel.h>
  12. #define RAMSIZE (*(grub_uint32_t *) ((16 << 20) - 264))
  13. grub_uint32_t
  14. grub_get_rtc (void)
  15. {
  16. static int calln = 0;
  17. return calln++;
  18. }
  19. void
  20. grub_machine_init (void)
  21. {
  22. grub_mm_init_region ((void *) GRUB_MACHINE_MEMORY_USABLE,
  23. RAMSIZE - (GRUB_MACHINE_MEMORY_USABLE & 0x7fffffff));
  24. grub_install_get_time_ms (grub_rtc_get_time_ms);
  25. }
  26. void
  27. grub_machine_fini (void)
  28. {
  29. }
  30. void
  31. grub_exit (void)
  32. {
  33. while (1);
  34. }
  35. void
  36. grub_halt (void)
  37. {
  38. while (1);
  39. }
  40. void
  41. grub_reboot (void)
  42. {
  43. while (1);
  44. }
  45. grub_err_t
  46. grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
  47. grub_uint64_t,
  48. grub_uint32_t))
  49. {
  50. hook (0, RAMSIZE,
  51. GRUB_MACHINE_MEMORY_AVAILABLE);
  52. return GRUB_ERR_NONE;
  53. }