linux.init-i386.S 1.6 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 4
  19. #define SYSCALL_RESET 88
  20. #define SYSCALL_IOPL 110
  21. #define SYSCALL_EXIT 1
  22. #define SYSCALL_INT 0x80
  23. #define STDOUT 1
  24. #define SHUTDOWN_MAGIC1 0xfee1dead
  25. #define SHUTDOWN_MAGIC2 0x28121969
  26. #define SHUTDOWN_MAGIC3 0x4321fedc
  27. .text
  28. .global start, _start
  29. _start:
  30. start:
  31. /* write. */
  32. movl $SYSCALL_WRITE, %eax
  33. movl $STDOUT, %ebx
  34. leal message, %ecx
  35. movl $(messageend-message), %edx
  36. int $SYSCALL_INT
  37. movl $SYSCALL_IOPL, %eax
  38. movl $3, %ebx
  39. int $SYSCALL_INT
  40. #include "qemu-shutdown-x86.S"
  41. /* shutdown. */
  42. movl $SYSCALL_RESET, %eax
  43. movl $SHUTDOWN_MAGIC1, %ebx
  44. movl $SHUTDOWN_MAGIC2, %ecx
  45. movl $SHUTDOWN_MAGIC3, %edx
  46. int $SYSCALL_INT
  47. /* exit (1). Shouldn't be reached. */
  48. movl $SYSCALL_EXIT, %eax
  49. movl $1, %ebx
  50. int $SYSCALL_INT
  51. .data
  52. message:
  53. .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
  54. messageend: