Guest User

boot.S

a guest
Apr 6th, 2015
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .intel_syntax noprefix
  2.  
  3. # ----------------------------------------------------------------------
  4. # .multiboot: declare header in mutliboot standard
  5.  
  6. .section .multiboot
  7. .align 4
  8.  
  9.     # some constants for multiboot header:
  10.     .set ALIGN, 1<<0                # align loaded modules on page boundaries
  11.     .set MEMINFO, 1<<1              # provide memory map
  12.     .set FLAGS, ALIGN | MEMINFO     # mutliboot flags
  13.     .set MAGIC, 0x1BADB002          # 'magic number' lets bootloader find header
  14.     .set CHECKSUM, -(MAGIC + FLAGS) # checksum of the mboot header
  15.  
  16.     .long MAGIC
  17.     .long FLAGS
  18.     .long CHECKSUM
  19.  
  20. # ----------------------------------------------------------------------
  21. # allocate some stack space
  22.  
  23. .section .bootstrap_stack, "aw", @nobits
  24.  
  25. stack_bottom:
  26.     .skip 16384    # 16 KB
  27. stack_top:
  28.  
  29. # ----------------------------------------------------------------------
  30. # .text: the global function _start represents our kernel entry point in
  31. #        our .text segment
  32.  
  33. .section .text
  34.  
  35.     .globl _start
  36.     .type _start, @function
  37.  
  38. _start:
  39.     # first, setup a stack:
  40.     mov esp, stack_top
  41.  
  42.     call _init
  43.  
  44.     call k_early_init
  45.  
  46.     call k_main
  47.  
  48. endless:
  49.     jmp endless
  50.  
  51. # ----------------------------------------------------------------------
  52. # signalize end of module: size of the code -- for debugging purposes:
  53.  
  54. .size _start, . - _start
Advertisement
Add Comment
Please, Sign In to add comment