linux.init-mips.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2010 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #define SYSCALL_WRITE 4004
  19. #define SYSCALL_RESET 4088
  20. #define SYSCALL_EXIT 4001
  21. #define STDOUT 1
  22. #define SHUTDOWN_MAGIC1 0xfee1dead
  23. #define SHUTDOWN_MAGIC2 0x28121969
  24. #ifdef REBOOT
  25. #define SHUTDOWN_MAGIC3 0x01234567
  26. #else
  27. #define SHUTDOWN_MAGIC3 0x4321fedc
  28. #endif
  29. .text
  30. .global start, _start, __start
  31. __start:
  32. _start:
  33. start:
  34. /* write. */
  35. li $v0, SYSCALL_WRITE
  36. li $a0, STDOUT
  37. lui $a1, %hi(message)
  38. addiu $a1, %lo(message)
  39. lui $a2, %hi(messageend)
  40. addiu $a2, %lo(messageend)
  41. subu $a2, $a2, $a1
  42. syscall
  43. /* shutdown. */
  44. li $v0, SYSCALL_RESET
  45. li $a0, SHUTDOWN_MAGIC1
  46. li $a1, SHUTDOWN_MAGIC2
  47. li $a2, SHUTDOWN_MAGIC3
  48. syscall
  49. /* exit(1). Shouldn't be reached. */
  50. li $v0, SYSCALL_EXIT
  51. li $a0, 1
  52. syscall
  53. .data
  54. message:
  55. .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
  56. messageend: