cartoon-raccoon

GNU as boot code

Oct 5th, 2021 (edited)
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. # Declare constants for the multiboot header
  2. .set ALIGN, 1<<0
  3. .set MEMINFO, 1<<1
  4. .set FLAGS, ALIGN | MEMINFO
  5. .set MAGIC, 0x1BADB002
  6. .set CHECKSUM, -(MAGIC + FLAGS)
  7.  
  8. # Declare the multiboot header
  9. .section .multiboot
  10. .align 4
  11. .long MAGIC
  12. .long FLAGS
  13. .long CHECKSUM
  14.  
  15. # Set up a stack
  16. .section .bss
  17. .align 16
  18. stack_bottom:
  19. .skip 16384
  20. stack_top:
  21.  
  22. # The entry point
  23. .section .text
  24. .global _start
  25. .type _start, @function
  26. _start:
  27. movl $stack_top, %esp
  28.  
  29. call _init
  30.  
  31. call kernel_main
  32. cli
  33. 1: hlt
  34. jmp 1b
  35. .size _start, . - _start
Add Comment
Please, Sign In to add comment