entry.S 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*++
  2. Copyright (c) 2014 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. entry.S
  9. Abstract:
  10. This module implements the entry point for the PC/AT boot manager.
  11. Author:
  12. Evan Green 21-Feb-2014
  13. Environment:
  14. Kernel mode
  15. --*/
  16. //
  17. // ------------------------------------------------------------------ Includes
  18. //
  19. #include <minoca/kernel/x86.inc>
  20. //
  21. // ---------------------------------------------------------------------- Code
  22. //
  23. //
  24. // .text specifies that this code belongs in the executable section.
  25. //
  26. // .code32 specifies that this is 32-bit protected mode code.
  27. //
  28. .text
  29. .code32
  30. //
  31. // Stick this in the .init section so it ends up at the front of the binary.
  32. //
  33. .section .init
  34. //
  35. // .globl allows this label to be visible to the linker.
  36. //
  37. .globl _start
  38. //
  39. // void
  40. // start (
  41. // VOID
  42. // )
  43. //
  44. /*++
  45. Routine Description:
  46. This routine implements the entry point for the loader. It jumps to the
  47. main C routine.
  48. Arguments:
  49. None.
  50. Return Value:
  51. TRUE if interrupts are enabled in the processor.
  52. FALSE if interrupts are globally disabled.
  53. --*/
  54. _start:
  55. movl $__bss_start, %edi # Get the start of the BSS section.
  56. movl $_end, %ecx # Get the end address.
  57. subl %edi, %ecx # Subtract the start to get the BSS size.
  58. xorl %eax, %eax # The byte to write is zero.
  59. cld # Count up.
  60. rep stosb # Store zero bytes to EDI, ECX times.
  61. jmp BmPcatApplicationMain # Jump to the real function.
  62. //
  63. // --------------------------------------------------------- Internal Functions
  64. //