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.
 
 
 
 
 
 

74 lines
1.7 KiB

  1. /* boot.S - bootstrap the kernel */
  2. /* Copyright (C) 1999 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
  14. #define ASM 1
  15. #include <multiboot.h>
  16. .text
  17. .code32
  18. .globl start, _start
  19. /* This entry is not used actually. */
  20. start:
  21. _start:
  22. jmp multiboot_entry
  23. /* Align 32 bits boundary. */
  24. .align 4
  25. /* Multiboot header. */
  26. multiboot_header:
  27. /* magic */
  28. .long MULTIBOOT_HEADER_MAGIC
  29. /* flags */
  30. .long MULTIBOOT_HEADER_FLAGS
  31. /* checksum */
  32. .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
  33. /* header_addr */
  34. .long multiboot_header
  35. /* load_addr */
  36. .long _start
  37. /* load_end_addr */
  38. .long _edata
  39. /* bss_end_addr */
  40. .long _end
  41. /* entry_addr */
  42. .long multiboot_entry
  43. multiboot_entry:
  44. /* Initialize the stack pointer. */
  45. movl $(stack + STACK_SIZE), %esp
  46. /* Reset EFLAGS. */
  47. pushl $0
  48. popf
  49. /* Push the pointer to the Multiboot information structure. */
  50. pushl %ebx
  51. /* Push the magic value. */
  52. pushl %eax
  53. /* Now enter the C main function... */
  54. call EXT_C(cmain)
  55. loop: hlt
  56. jmp loop
  57. /* Our stack area. */
  58. .comm stack, STACK_SIZE